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 (S1); | wait (S2); |
| wait (S0); | release (S0); | release (S0); |
| print '0'; | ||
| release (S1); | ||
| release (S2); | ||
| } |
How many times will process P0 print ‘0’?
Reveal answer
Fill a bubble to check yourself
