GATEverse
← GATE CSE 2010

Q45

MCQ2 marks, −0.67

The following program consists of 33 concurrent processes and 33 binary semaphores. The semaphores are initialized as S0=1,S1=0S0=1, S1=0 and S2=0.S2=0.

Process P0Process P1Process P2while (true) {wait (S1);wait (S2); wait (S0);release (S0);release (S0); print ‘0’; release (S1); release (S2);}\begin{array}{|l|l|}\hline \text{Process P0} & \text{Process P1} & \text{Process P2} \\ \hline \text{while (true) \{} & \text{wait (S1);} & \text{wait (S2);} \\ \text{ wait (S0);} & \text{release (S0);} & \text{release (S0);} \\ \text{ print ‘0';} & & \\ \text{ release (S1);} & & \\ \text{ release (S2);} & \text{} & \text{} \\ \text{\}} & \text{} \\\hline \end{array}

How many times will process P0P0 print '00'?

Sign in to save attempts.

Loading…