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

Given below is the code of three processes P1, P2 and P3

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!