GATE 2013 CS (CS1) – Question 26
Binary semaphores a,b,c,d start at one. X needs a,b,c; Y needs b,c,d; Z needs c,d,a, releasing all after its code. Which acquisition order is deadlock-free?
Practise this question in The GATE Grind →
Show answer and explanation
Correct answer: (B) X:bac; Y:bcd; Z:acd
Explanation
Option B follows one global resource order b<a<c<d: X acquires b,a,c; Y b,c,d; Z a,c,d. A circular wait is impossible when every process acquires resources in increasing global order. Thus B is deadlock-free; the other options admit inconsistent ordering cycles.