UGC NET CS 2017System Software and Operating System › DeadlocksVerified
UGC NET CS 2017 PYQ: Consider a system with five processes $P_0$ through $P_4$ and three resource types $A, B$ and $C$. Resource…
Consider a system with five processes $P_0$ through $P_4$ and three resource types $A, B$ and $C$. Resource type $A$ has seven instances, resource type $B$ has two instances and resource type $C$ has six instances suppose at time $T_0$ we have the following allocation.

If we implement Deadlock detection algorithm we claim that system is ________
- ASemaphore
- BDeadlock state
- CCircular wait
- DNot in deadlock stateCorrect answer
Answer
(D) Not in deadlock state
Approach
The deadlock-detection algorithm repeatedly finds a process whose remaining request can be satisfied by the current Work/Available vector, lets it finish, and adds its allocated resources back. Initially, Available $= (0,0,0)$. The rows with zero request, $P_0$ and $P_2$, can run. $P_0$ releases $(0,1,0)$, giving Available $(0,1,0)$; $P_2$ releases $(3,0,3)$, giving Available $(3,1,3)$. Now $P_3$ requests $(1,0,0) \le (3,1,3)$, so it finishes and releases $(2,1,1)$, making Available $(5,2,4)$ (or $(5,4,6)$ if the image's $P_4$ allocation is read as $(0,2,2)$). $P_4$ requests $(0,0,2) \le (5,2,4)$, so it finishes; finally $P_1$ requests $(2,0,2)$, which is also satisfiable. Hence every process can complete, so the state is not deadlocked. Note that the allocation totals appear inconsistent for resource $B$ (summing to a value larger than the stated total), but this does not affect the reduction argument: since a valid safe sequence $P_0, P_2, P_3, P_4, P_1$ exists, the system is not in a deadlock state. Therefore the correct option is D.
Reviewed by UGC IQ Editorial Team.