retagged by
233 views
0 votes
0 votes

Consider the following code.

int count = 0;
void *thfunc ()
{
    int ctr = 0;
    for(ctr=0; ctr<100; ctr++)
        count++;
}

If thfunc is executed by two threads concurrently in a uniprocessor system, what will be the $\textbf{MINIMUM}$ value of count when both threads complete their execution? Assume that count++ is performed using three instructions: (i) read value of count from memory to a $\text{CPU}$ register $\text{R},$ (ii) increament $\text{R},$ and (iii) store the value of $\text{R}$ in memory.

  1. $200$
  2. $100$
  3. $2$
  4. None of the above
retagged by

Please log in or register to answer this question.

Answer:

Related questions