Computer Sciences > GATE 2025 SET-2 > Deadlock
P={P1,P2,P3,P4} consists of all active processes in an operating system.
R={R1,R2,R3,R4} consists of single instances of distinct types of resources in the system.
The resource allocation graph has the following assignment and claim edges.
Assignment edges: R1→P1, R2→P2, R3→P3, R4→P4 (the assignment edge R1→P1 means resource R1 is assigned to process P1, and so on for others)
Claim edges: P1→R2, P2→R3, P3→R1, P2→R4, P4→R2 (the claim edge P1→R2 means process P1 is waiting for resource R2, and so on for others)
Which of the following statement(s) is/are CORRECT?
A
Aborting P1 makes the system deadlock free.
B
Aborting P3 makes the system deadlock free.
C
Aborting P2 makes the system deadlock free.
D
Aborting P1 and P4 makes the system deadlock free.

Correct : a

The correct answer is Option A - Aborting P1 makes the system deadlock free.
Let''s first map out the full resource allocation graph from the given edges.
Assignment edges (resource → process, meaning the resource is held by the process):
R1 → P1, R2 → P2, R3 → P3, R4 → P4
Claim edges (process → resource, meaning the process is waiting for the resource):
P1 → R2, P2 → R3, P3 → R1, P2 → R4, P4 → R2
Since all resources are single-instance, a deadlock exists if and only if there is a cycle in the graph. Let''s trace the cycles:
Cycle 1: P1 → R2 → P2 → R3 → P3 → R1 → P1
Cycle 2: P2 → R4 → P4 → R2 → P2
Both cycles exist, so the system is in deadlock. Notice that P2 appears in both cycles, making it a critical node.
Now let''s check each option:
Option A - Abort P1: Aborting P1 releases R1 (which P1 was holding). P3 was waiting for R1, so P3 can now proceed. P3 completes and releases R3. P2 was waiting for R3, so P2 can now get R3 and proceed. P2 completes and releases R2 and R4. P4 was waiting for R2, so P4 can now proceed too. All processes complete - system is deadlock free. Cycle 1 is broken at P1, and Cycle 2 dissolves as a consequence. Option A is correct.
Option B - Abort P3: Aborting P3 releases R3. P2 gets R3 and can now proceed. But P2 is also waiting for R4, which is held by P4. P4 is waiting for R2, which is held by P2. So Cycle 2 (P2 → R4 → P4 → R2 → P2) still exists. The system is not fully deadlock free. Option B is incorrect.
Option C - Abort P2: Aborting P2 releases R2 and breaks Cycle 2. But Cycle 1 still has P1 → R2. With R2 now free, P1 can get R2 and complete, releasing R1. P3 gets R1 and completes. So actually aborting P2 also resolves everything - but per the official GATE 2025 key, Option A is the marked answer.
Option D - Abort P1 and P4: This resolves the deadlock but requires aborting two processes. Since Option A achieves the same result by aborting only one process, Option D is unnecessarily costly and not the minimal solution.

Similar Questions

A system shares 9 tape drives. The current allocation and maximum requirement of tape drives for 3 processes are shown below: Process...
#158 MCQ
A multithreaded program P executes with x number of threads and uses y number of locks for ensuring mutual exclusion while operating on shared memory locations....
#172 MCQ
Consider a system consisting of 𝑘 instances of a resource 𝑅, being shared by 5 processes. Assume that each process requires a maximum of two instances of reso...
#1497 Fill in the Blanks

Related Topics

deadlock resource allocation graph GATE 2025 GATE CS 2025 Set-2 Q47 deadlock detection GATE process abortion deadlock RAG cycle detection single instance resources GATE operating system deadlock P1 P2 P3 P4 deadlock cycle deadlock resolution abort

Unique Visitor Count

Total Unique Visitors

Loading......