GATE / CS ARCHIVE

GATE CSE 1994 / QUESTION 28(a)

Deadlock detection with multiple resource instances

Operating Systems · Deadlocks · Full GATE CSE 1994 paper

GATE 1994, Q28(a) Descriptive
Report issue

Deadlocks

Question 28(a), GATE 1994: Resource types r1,r2,r3 have respectively 2,3,2 instances. Assignments are r1→P1 and r1→P0; r2→P1, r2→P2 and r2→P3; r3→P0, leaving one r3 instance free. Outstanding requests are P1→r1; P0→r2 and P0→r3; P2→r3; P3→r1 and two P3→r2 arrows. Does the depicted resource-allocation graph represent deadlock?
Question 28(a), GATE 1994: Resource types r1,r2,r3 have respectively 2,3,2 instances. Assignments are r1→P1 and r1→P0; r2→P1, r2→P2 and r2→P3; r3→P0, leaving one r3 instance free. Outstanding requests are P1→r1; P0→r2 and P0→r3; P2→r3; P3→r1 and two P3→r2 arrows. Does the depicted resource-allocation graph represent deadlock?
Question 28(a), GATE 1994: Resource types r1,r2,r3 have respectively 2,3,2 instances. Assignments are r1→P1 and r1→P0; r2→P1, r2→P2 and r2→P3; r3→P0, leaving one r3 instance free. Outstanding requests are P1→r1; P0→r2 and P0→r3; P2→r3; P3→r1 and two P3→r2 arrows. Does the depicted resource-allocation graph represent deadlock?
Tap to enlarge
Answer & solution

Answer: No, under the standard assumption that a process finishes and releases its holdings after its depicted requests are granted. (no official key was published)

Read each dot-to-process arrow as an allocated instance and each process-to-resource arrow as an outstanding request. In resource order (r1,r2,r3), total resources are (2,3,2). The allocation rows are P0=(1,0,1), P1=(1,1,0), P2=(0,1,0), P3=(0,1,0); their sum is (2,3,1), leaving Work=(0,0,1). The request rows are P0=(0,1,1), P1=(1,0,0), P2=(0,0,1), P3=(1,2,0). The two parallel P3→r2 arrows mean two requested instances, not a duplicated decorative edge.

Initially P2 is the process whose request vector is componentwise at most Work. Give it the free r3 instance. Under the standard graph-reduction model it completes, releasing that temporary grant and its held r2 instance. Consequently Work increases by its original allocation, from (0,0,1) to (0,1,1). P0 can now receive its requested r2 and r3 instances and complete, increasing Work to (1,1,2). P1 can then finish and increase Work to (2,2,2). Finally P3's request (1,2,0) is satisfiable, so it also completes.

All process nodes can be removed, so the current graph does not describe a deadlock. Cycles alone are insufficient to infer deadlock when resource types have multiple instances. This is a reduction of the displayed current requests, not a claim of Banker safety against unknown additional future maximum demands; no such maxima are supplied.

Original paper, page 7