All Exams Test series for 1 year @ ₹349 only
Question

$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 \rightarrow P_1, R_2 \rightarrow P_2, R_3 \rightarrow P_3, R_4 \rightarrow P_4$ (the assignment edge $R_1 \rightarrow P_1$ means resource $R_1$ is assigned to process $P_1$, and so on for others)
Claim edges: $P_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 $P_1 \rightarrow 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?

To determine which processes to abort in order to make the system deadlock-free, we need to analyze the resource allocation graph and identify deadlock-causing cycles.

  • Processes: \(P = \{P_1, P_2, P_3, P_4\}\)
  • Resources: \(R = \{R_1, R_2, R_3, R_4\}\)
  • Assignment Edges:
    • \(R_1 \rightarrow P_1\)
    • \(R_2 \rightarrow P_2\)
    • \(R_3 \rightarrow P_3\)
    • \(R_4 \rightarrow P_4\)
  • Claim Edges:
    • \(P_1 \rightarrow R_2\)
    • \(P_2 \rightarrow R_3\)
    • \(P_3 \rightarrow R_1\)
    • \(P_2 \rightarrow R_4\)
    • \(P_4 \rightarrow R_2\)

A system is said to be in a deadlock state if there exists a cycle in the resource allocation graph. The cycle here can be detailed as:

  • Cycle 1: \(P_1 \rightarrow R_2 \rightarrow P_2 \rightarrow R_3 \rightarrow P_3 \rightarrow R_1 \rightarrow P_1\)
  • Cycle 2: \(P_2 \rightarrow R_4 \rightarrow P_4 \rightarrow R_2 \rightarrow P_2\)

To break these cycles, we need to consider the effects of aborting different processes:

  • Option 1: Aborting \(P_1\)
    • Breaks Cycle 1 by removing \(P_1\) from the graph, but Cycle 2 persists.
  • Option 2: Aborting \(P_3\)
    • Breaks part of Cycle 1, but Cycle 2 persists, and a portion of Cycle 1 can still exist via \(P_1\rightarrow R_2 \rightarrow P_2\rightarrow R_4\rightarrow P_4\).
  • Option 3: Aborting \(P_2\)
    • Breaks both Cycle 1 and Cycle 2 effectively.
  • Option 4: Aborting \(P_1\) and \(P_4\)
    • Breaks both Cycle 1 and Cycle 2 by removing all dependencies associated with the deadlock cycles.

Hence, the correct deadlock-breaking choices are:

  • Aborting \(P_2\) makes the system deadlock-free.
  • Aborting \(P_1\) and \(P_4\) makes the system deadlock-free.
Was this answer helpful?

Important Questions from Deadlock

  1. Which of the following is NOT the method for handling deadlock?

Need Expert Advice?

Start Your Preparation with Prepp Mobile App

Download the app from Google Play & App Store
Download the app from Google Play & App Store
Prepp Mobile App