Skip to content
Related Articles
Get the best out of our app
Open App

Related Articles

GATE | GATE CS 1997 | Question 48

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

Each Process Pi, i= 1…….9 is coded as follows

    {Critical section}

The code for P10 is identical except it uses V(mutex) in place of P(mutex). What is the largest number of processes that can be inside the critical section at any moment?
(A) 1
(B) 2
(C) 3
(D) None of above

Answer: (D)

Explanation: Consider code for i= 1 to 9
Initially mutex value set to 1, so it can allow only 1 process at a time. Now p1 enter into critical section and by this time remaining all are in block state. (i.e blocked processes= 2,3,4,5,6,7,8,9). But consider code for 10th process, it tells that unblock any process because it contain operation. Because of this it can unblock the processes and send it to the critical section. By doing this all processes can enter into critical section. So, finally there are 10 processes at maximum can enter into critical section.

Alternative Way-
There is loop which runs forever So P10 runs forever. And it has capability to put all other processes to Critical Section. Moreover they Asked Maximum Number of process that can be Present at critical Section So Answer is 10.

Option (D) is correct.

This explanation is contributed by Ajay Puri.

Quiz of this Question

Quiz of this Question

My Personal Notes arrow_drop_up
Last Updated : 07 Feb, 2019
Like Article
Save Article
Similar Reads