Skip to content
Official PYQ · 2017

GATE CS 2017 Set 2 Q33 — Deadlock

Explain with AI

A system shares 99 tape drives. The current allocation and maximum requirement of tape drives for that processes are shown below:

ProcessCurrent AllocationMaximum RequirementP137P216P335\begin{array}{|c|c|} \hline \textbf{Process} & \textbf{Current Allocation} & \textbf{Maximum Requirement} \\ \hline \text{P1} & 3 & 7 \\ \hline \text{P2} & 1 & 6 \\ \hline \text{P3} & 3 & 5 \\ \hline \end{array}

Which of the following best describes current state of the system?

Choose one option
View worked solution

Answer: B

To determine the state of the system, we first calculate the total allocated resources, the available resources, and the remaining need for each process.

1. Calculate Available Resources:

  • Total tape drives = 99
  • Total allocated = Allocation(P1)+Allocation(P2)+Allocation(P3)=3+1+3=7\text{Allocation}(P1) + \text{Allocation}(P2) + \text{Allocation}(P3) = 3 + 1 + 3 = 7
  • Available=9−7=2\text{Available} = 9 - 7 = 2

2. Calculate Remaining Need:

  • Need(P1)=Max(P1)−Allocation(P1)=7−3=4\text{Need}(P1) = \text{Max}(P1) - \text{Allocation}(P1) = 7 - 3 = 4
  • Need(P2)=Max(P2)−Allocation(P2)=6−1=5\text{Need}(P2) = \text{Max}(P2) - \text{Allocation}(P2) = 6 - 1 = 5
  • Need(P3)=Max(P3)−Allocation(P3)=5−3=2\text{Need}(P3) = \text{Max}(P3) - \text{Allocation}(P3) = 5 - 3 = 2

3. Find a Safe Sequence:

  • With Available=2\text{Available} = 2, we can satisfy the need of P3P3 since Need(P3)=2≤2\text{Need}(P3) = 2 \le 2. After P3P3 completes and releases its resources, the new available resources become: Available=2+3=5\text{Available} = 2 + 3 = 5
  • With Available=5\text{Available} = 5, we can satisfy the need of P1P1 since Need(P1)=4≤5\text{Need}(P1) = 4 \le 5. After P1P1 completes and releases its resources, the new available resources become: Available=5+3=8\text{Available} = 5 + 3 = 8
  • With Available=8\text{Available} = 8, we can satisfy the need of P2P2 since Need(P2)=5≤8\text{Need}(P2) = 5 \le 8.

Since a safe sequence ⟨P3,P1,P2⟩\langle P3, P1, P2 \rangle exists, the system is in a Safe state, which guarantees that it is Not Deadlocked.

Free practice · Your answers on this page are not saved.

Published
Report a correction
Keep exploringMore Deadlock questions