The GATE Grind

GATE 2025 CS (CS2) – Question 48

Operating System · Deadlock · 2 marks · Multiple select

$P = \{P_1, P_2, P_3, P_4\}$ consists of all active processes in an operating system. $R = \{R_1, R_2, R_3, R_4\}$ 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: $R_1 \to P_1,\ R_2 \to P_2,\ R_3 \to P_3,\ R_4 \to P_4$ (the assignment edge $R_1 \to P_1$ means resource $R_1$ is assigned to process $P_1$, and so on for others)

Claim edges: $P_1 \to R_2,\ P_2 \to R_3,\ P_3 \to R_1,\ P_2 \to R_4,\ P_4 \to R_2$ (the claim edge $P_1 \to R_2$ means process $P_1$ is waiting for resource $R_2$, and so on for others)

Which of the following statement(s) is/are CORRECT?

  1. Aborting $P_1$ makes the system deadlock free.
  2. Aborting $P_3$ makes the system deadlock free.
  3. Aborting $P_2$ makes the system deadlock free.
  4. Aborting $P_1$ and $P_4$ makes the system deadlock free.

Practise this question in The GATE Grind →

Show answer and explanation

Correct answer: (C) Aborting $P_2$ makes the system deadlock free.; (D) Aborting $P_1$ and $P_4$ makes the system deadlock free.

Explanation

The wait-for graph has cycles P1→P2→P3→P1 and P2→P4→P2, and both pass through P2. Aborting P2 breaks both cycles. Aborting only P1 or only P3 leaves the P2–P4 cycle, while aborting P1 and P4 removes every cycle.