Question: Given below is the code of three processes P1, P2 and P3 running simultaneously in a computer system. Processes use two shared binaries semaphores, s1
Given below is the code of three processes P1, P2 and P3 running simultaneously in a computer system. Processes use two shared binaries semaphores, s1 and s2 initialized to 1 and 0, respectively

After all three processes have finished executing, which of the following strings can NOT be printed? a) The string 'yxz' b) The string 'yzx' c) The string 'zyx' d) The string 'zxy'
semaphore: s1=1,s2=0; \begin{tabular}{l|l|l} \hline \multicolumn{1}{c|}{P1} & P2 & P3 \\ wait(s2); & wait(s1); & wait(s1); \\ wait(s1); & print(''y'); & print(''z'); \\ print((x);signal(s1); & signal(s1); & signal(s1); \\ signal(s2); & \\ \hline \end{tabular}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
