Deadlocks
![Question 1.21, GATE 2000: Processes P[0]…P[4] use mutexes m[0]…m[4]. Each waits on m[i], then m[(i+1) mod4], before releasing them. Can this cause thrashing, deadlock, starvation without deadlock, or none?](../../assets/questions/CS-2000-Q21-1.webp)
Your answer
Answer & solution
Answer: B (no official key was published)
Step 1: Schedule P0,P1,P2,P3 so each acquires its first mutex before any attempts the second. They now hold m0,m1,m2,m3 respectively.
Step 2: P0 waits for m1, P1 for m2, P2 for m3, and P3 for m0. Each resource is held by the next blocked process, creating a circular wait.
Thus deadlock is possible, B. The printed modulus is 4 even though five processes/mutexes are named; the four-process cycle already proves the result without silently changing it to 5. P4 does not remove this cycle.