Skip to main content

GATE CSE 2026Operating System › Deadlocks & Resource AllocationVerified

GATE CSE 2026 PYQ: Consider a system consisting of k k k instances of a resource R R R , being shared by 5 5 5 processes.…

Consider a system consisting of kk instances of a resource RR, being shared by 5 processes. Assume that each process requires a maximum of two instances of resource RR and a process can request or release only one instance at a time. Further, a process can request the second instance of the resource only after acquiring the first instance.

The minimum value of kk for the system to be deadlock-free is ____\_\_\_\_. (answer in integer)

    Answer

    6

    Approach

    Use the deadlock-avoidance formula for a single resource type: if there are n processes and each process has maximum demand $m_i$, then the minimum number of resource instances needed to guarantee deadlock-freedom is $\sum_i (m_i - 1) + 1$. Here n = 5 and $m_i = 2$ for every process, so the required minimum is 5(2 - 1) + 1 = 6.

    With 5 processes each needing at most 2 instances of a single resource type, total resources must exceed the sum of each process's maximum demand minus one. That gives 5(2 - 1) + 1 = 6 resources. Hence k = 6 guarantees deadlock-freedom.

    Reviewed by GateIQ Editorial Team: IIT & IISc Alumni.