Subjects Subjects About Login

OS : 1997 GATE Questions

Questions : 1


QID : 67GATE-1997, 2M

Each process Pi, i=1....9 is coded as follows:

REPEAT
P(mutex)
{
critical section
}
V(mutex)
FOREVER

The code for P10 is identical except that it uses V(mutex) in place of P(mutex). What is the largest number of process that can be inside critical section at any moment.

Options:
A) 1
B) 2
C) 3
D) None of the above
Ans : Option D
Solution :
Lets assume P1 starts then P2 starts and so on upto P9.
In such cases assume mutex is 1 initially.
P1 will enter CS making mutex 1 to 0.
P2 to P9 will blocked by P(mutex) and they will sit in queue.

Then P10 starts and executes V(mutex) continuously since its Repeat-forever,
Each time it performs V(mutex), it will dequeue one process from queue and allow it to enter in CS.
So all P2 to P9 will eventually enter in CS.
P10 can enter in CS anytime.

So, all 10 processes can canter in CS simultaneously.
 

Have a Question?


Submit Here

Previous GATE Papers


Year Key Organized by
2019 Key IIT Madras
2018 Key IIT Guwahati
2017(Set1) Key IIT Roorkee
2017(Set2) Key IIT Roorkee
2016(Set1) Key IISc
2016(Set2) Key IISc
Show All