Q2. (5 pts) Consider 3 concurrent processes P1, P2, P3 as in the following table. S1, S2, and S3 are semaphores all init
Posted: Mon Jun 06, 2022 1:57 pm
Q2. (5 pts) Consider 3 concurrent processes P1, P2, P3 as in the following table. S1, S2, and S3 are semaphores all initialized to 0. What are the possible outputs of this concurrent execution? For every answer you provide, show your work including possible intermediate values for S1, S2, and S3. Make any assumptions you see necessary but clearly state them. P1 P2 P3 for (int i=0; i<2; i++) for (int i=0; i<2; i++) for (int i=0; i<2; i++) { { { Print "X"; Print "Y"; wait (S3); signal (S3); signal (S3); wait (S3); Print "Z"; wait (S1); wait(S2); signal (S2); signal (S1);