Question 1
[Tex]\begin{aligned} &\text{Consider three processes P1, P2, and P3 running} \\ &\text{identical code, as shown in the pseudocode below.} \\ &\text{A and B are two binary semaphores initialized to 1} \\ &\text{and 0, respectively. X is a shared variable} \\ &\text{initialized to 0. Each line in the pseudocode is} \\ &\text{executed atomically.} \\ &\text{Pseudocode of P1, P2, and P3:} \\ \\ &\text{wait(A);} \\ &\text{print(*);} \\ &\text{X=X+1;} \\ \\ &\text{if(X==2)} \\ &\text{\{} \\ &\quad \text{print(\$);} \\ &\quad \text{signal(B);} \\ &\text{\}} \\ \\ &\text{signal(A);} \\ \\ &\text{wait(B);} \\ &\text{print(\#);} \\ &\text{signal(B);} \\ \\ &\text{Assume that any of the three processes can start to} \\ &\text{execute first and context switching can happen} \\ &\text{between these processes at any arbitrary time and} \\ &\text{in any arbitrary order.} \\ &\text{Which of the following patterns is/are possible to} \\ &\text{be generated as an outcome of the execution of} \\ &\text{these three processes?} \end{aligned}[/Tex]
[GATE 2026 || SET-2 MSQ || 2-mark]
**$*###
**$#*##
**$##*#
***$###
There are 1 questions to complete.