GATE | GATE CS 2010 | Question 45
The following program consists of 3 concurrent processes and 3 binary semaphores.The semaphores are initialized as S0 = 1, S1 = 0, S2 = 0.
How many times will process P0 print ‘0’?
(A) At least twice
(B) Exactly twice
(C) Exactly thrice
(D) Exactly once
Answer: (A)
Explanation: Initially only P0 can go inside the while loop as S0 = 1, S1 = 0, S2 = 0.
P0 first prints ‘0’ then, after releasing S1 and S2, either P1 or P2 will execute and release S0. So 0 is printed again.
Quiz of this Question
Recommended Posts:
- GATE | GATE CS 2010 | Question 61
- GATE | GATE CS 2010 | Question 65
- GATE | GATE CS 2010 | Question 24
- GATE | GATE CS 2010 | Question 23
- GATE | GATE CS 2010 | Question 22
- GATE | GATE CS 2010 | Question 21
- GATE | GATE CS 2010 | Question 20
- GATE | GATE CS 2010 | Question 19
- GATE | GATE CS 2010 | Question 26
- GATE | GATE CS 2010 | Question 27
- GATE | GATE CS 2010 | Question 65
- GATE | GATE CS 2010 | Question 33
- GATE | GATE CS 2010 | Question 62
- GATE | GATE CS 2010 | Question 65
- GATE | GATE CS 2010 | Question 64




