Question

P={P1,P2,P3,P4}P = \{P_1, P_2, P_3, P_4\} consists of all active processes in an operating system. R={R1,R2,R3,R4}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: R1→P1,  R2→P2,  R3→P3,  R4→P4R_1 \rightarrow P_1, \; R_2 \rightarrow P_2, \; R_3 \rightarrow P_3, \; R_4 \rightarrow P_4 (the assignment edge R1→P1R_1 \rightarrow P_1 means resource R1R_1 is assigned to process P1P_1, and so on for others)

Claim edges: P1→R2,  P2→R3,  P3→R1,  P2→R4,  P4→R2P_1 \rightarrow R_2, \; P_2 \rightarrow R_3, \; P_3 \rightarrow R_1, \; P_2 \rightarrow R_4, \; P_4 \rightarrow R_2 (the claim edge P1→R2P_1 \rightarrow R_2 means process P1P_1 is waiting for resource R2R_2, and so on for others)

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

Choose every correct option
Official answer and solution
Official answer
C and D
From
Official GATE 2025 answer key

Solution

Construct the wait-for graph (since each resource has a single instance) and identify all directed cycles.

Since each resource RiR_i has a single instance and is currently assigned to PiP_i, a claim edge Pa→RbP_a \rightarrow R_b corresponds to the wait-for edge Pa→PbP_a \rightarrow P_b. The wait-for graph has 5 directed edges:

P1→P2,P2→P3,P3→P1,P2→P4,P4→P2P_1 \rightarrow P_2, \quad P_2 \rightarrow P_3, \quad P_3 \rightarrow P_1, \quad P_2 \rightarrow P_4, \quad P_4 \rightarrow P_2

This graph contains exactly two elementary cycles:

  1. C1:P1→P2→P3→P1C_1: P_1 \rightarrow P_2 \rightarrow P_3 \rightarrow P_1
  2. C2:P2→P4→P2C_2: P_2 \rightarrow P_4 \rightarrow P_2

A set of aborted processes makes the system deadlock-free if and only if it intersects every cycle (a feedback vertex set):

  • Aborting only P1P_1 (A) or only P3P_3 (B) leaves cycle C2C_2 (P2↔P4P_2 \leftrightarrow P_4) deadlocked.
  • Aborting P2P_2 (C) breaks both C1C_1 and C2C_2, making the system deadlock-free.
  • Aborting P1P_1 and P4P_4 (D) breaks C1C_1 (via P1P_1) and C2C_2 (via P4P_4), also making the system deadlock-free.
Final answer

Options (C), (D)

The answer is the one in the official GATE answer key. The solution is this site's own explanation.

Source

Paper
GATE 2025 Computer Science and Information Technology - Session 2 (CS2)
Question
48 of 65
Section
Computer Science and Information Technology

Report an error in this question

GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.