retagged by
468 views
0 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

Please log in or register to answer this question.

Answer:
Position:
Show:

Related questions

0 0 votes
0 0 answers
398
398 views
admin asked Jan 5, 2019
398 views
Consider the following implementation as a solution to the critical section problem for two processes $\text{P}_{0}$ and $\text{P}_{1}$ with id $0$ and $1,$ respectively....
1 1 vote
0 0 answers
538
538 views
admin asked Jan 5, 2019
538 views
Consider the C program as below. There is a problem with this program which could lead to a cyber-attack on the program:#include<stdio.h #include<string.h #include<stdlib...
0 0 votes
0 0 answers
589
589 views
admin asked Jan 5, 2019
589 views
Consider the following statements regarding life time of any normally terminating process in an operating system.The process must be in $\text{RUNNING}$ state at least on...
0 0 votes
1 1 answer
568
568 views
admin asked Jan 5, 2019
568 views
Consider a computer system with $32-$ bit virtual addressing and page size of sixty-four kilobytes. The computer system has one-level page table per process with each pag...