engineering recuitment NIC NIELIT Scientist B 2023 Mock Test Operating Systems Concurrency and Synchronization Operating System Solution
The following program consists of 3 concurrent processes and 3 binary semaphores. The semaphores are initialized as S0=1, S1=0, S2=0.
|
Process P0 |
Process P1 |
Process P2 |
|
While (true) { Wait (S0); Print ‘0’ Release (S1); Release (S2); } |
Wait (S1); Release (S0); |
Wait (S2); Release (S0); |
How many times will process P0 print ‘0’?
1
At least twice
2
Exactly twice
3
Exactly thrice
4
Exactly once