GateAI
Deadlock

GATE CSE 2025 Set 2 · Q48

MSQ2 marksMedium

Time

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→P1R_1 \rightarrow P_1, R2→P2R_2 \rightarrow P_2, R3→P3R_3 \rightarrow P_3, R4→P4R_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→R2P_1 \rightarrow R_2, P2→R3P_2 \rightarrow R_3, P3→R1P_3 \rightarrow R_1, P2→R4P_2 \rightarrow R_4, P4→R2P_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?

Select all that applyOne or more correct

Pick every correct option

Solution

Step-by-step verified solution

Official answer: C) Aborting P2 makes the system deadlock free.; D) Aborting P1 and P4 makes the system deadlock free.

Deadlock

To determine which processes are involved in deadlock, let us construct the resource allocation graph (RAG) and identify all directed cycles (since each resource has a single instance, a cycle is necessary and sufficient for deadlock):

  1. Cycle 1:

    P1→R2→P2→R3→P3→R1→P1P_1 \rightarrow R_2 \rightarrow P_2 \rightarrow R_3 \rightarrow P_3 \rightarrow R_1 \rightarrow P_1

    Involving processes {P1,P2,P3}\{P_1, P_2, P_3\} and resources {R1,R2,R3}\{R_1, R_2, R_3\}.

  2. Cycle 2:

    P2→R4→P4→R2→P2P_2 \rightarrow R_4 \rightarrow P_4 \rightarrow R_2 \rightarrow P_2

    Involving processes {P2,P4}\{P_2, P_4\} and resources {R2,R4}\{R_2, R_4\}.

Now let us evaluate each option:

  • (A) Aborting P1P_1: Breaks Cycle 1, but Cycle 2 (P2→R4→P4→R2→P2P_2 \rightarrow R_4 \rightarrow P_4 \rightarrow R_2 \rightarrow P_2) still persists. Thus, the system is not deadlock-free. *(Incorrect)*

  • (B) Aborting P3P_3: Breaks Cycle 1, but Cycle 2 still persists. Thus, the system is not deadlock-free. *(Incorrect)*

  • (C) Aborting P2P_2: Since P2P_2 is part of both Cycle 1 and Cycle 2, aborting P2P_2 breaks both cycles. Resource R2R_2 is released. Then P1P_1 (waiting for R2R_2) and P4P_4 (waiting for R2R_2) can acquire R2R_2 and execute to completion sequentially, releasing all other resources so P3P_3 also finishes. Hence, the system becomes deadlock-free. *(Correct)*

  • (D) Aborting P1P_1 and P4P_4: Aborting P1P_1 breaks Cycle 1 and releases R1R_1. Aborting P4P_4 breaks Cycle 2 and releases R4R_4. With R1R_1 released, P3P_3 (waiting for R1R_1) acquires R1R_1, finishes, and releases R3R_3. Then P2P_2 (waiting for R3R_3 and R4R_4) gets both resources, executes to completion, and releases all resources. Thus, the system becomes deadlock-free. *(Correct)*

Hence, (C) and (D) are the correct statements.

Try the question first, then check your work.

Think the official key or this write-up is wrong?

Report error or challenge

Examiner trap

The misconception this question tests

This Deadlock previous year question is Q48 of the GATE CSE 2025 Set 2 paper. Find more GATE CSE PYQs on Deadlock in Operating Systems, or browse all GATE CSE PYQs.

Free diagnostic

Where do you stand for GATE?

Take the 20-minute diagnostic: the 3 topics that cost you the most marks, and a rank range. Or sit 5 related Deadlock PYQs now with no account.

One GATE CSE PYQ every morning

An official question by email at 7 AM IST, with a link to its verified solution. Unsubscribe in one click.

Deadlock in GATE CSE

Deadlock has 11 GATE CSE PYQs across 10 papers from 2014 to 2026. 2 of them are 2-mark MSQs like this one, and it is the only one in GATE CSE 2025 Set 2.

How GATE tests Deadlock

More from GATE CSE 2025 Set 2

Share this solution

A plain-text card for WhatsApp or Telegram study groups.

GateAI solution cardGATE CSE 2025 Set 2 · Q48 · MSQ

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?

Topic-wise GATE CS PYQs with verified steps

Independent practice explanation verified by the GateAI team. GATE is conducted by the IITs; question text follows the official paper.