-
The following program consist of 3 concurrent processes and 3 binary semaphores. The semaphores are initialized as S0 = 1, S1 = 0, S2 = 0
How many times will process P print ‘0’?
-
- Atleast twice
- Exactly twice
- Exactly thrice
- Exactly once
- Atleast twice
Correct Option: A
P0 uses a semaphore. Hence, anything whose value is 1, P0 will print ‘0’. After the release of S1 and S2, we observe that either P1 or P2 will release S0 so that it print ‘0’ at least 2 times.
Therefore, it is concluded that neither P1 nor P2 will go, it is the P0 that prints ‘0’ 2 times atleast.