GATE | GATE CS 1997 | Question 48
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 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
Recommended Posts:
- GATE | GATE CS 1997 | Question 36
- GATE | GATE CS 1997 | Question 42
- GATE | GATE CS 1997 | Question 43
- GATE | GATE CS 1997 | Question 44
- GATE | GATE CS 1997 | Question 45
- GATE | GATE CS 1997 | Question 46
- GATE | GATE CS 1997 | Question 41
- GATE | GATE CS 1997 | Question 46
- GATE | GATE CS 1997 | Question 47
- GATE | GATE CS 1997 | Question 49
- GATE | GATE CS 1997 | Question 37
- GATE | GATE CS 1997 | Question 38
- GATE | GATE CS 1997 | Question 39
- GATE | GATE CS 1997 | Question 40
- GATE | GATE CS 1997 | Question 58
Improved By : tejasgokani



