Skip to content
Official PYQ · 2026

GATE CS 2026 Set 1 Q25 — Deadlock

Explain with AI
Consider a system consisting of kk instances of a resource RR, being shared by 55 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)
View worked solution

Answer: 06 : 06

To ensure the system is deadlock-free, we analyze the worst-case resource allocation where a deadlock can potentially occur.

Let:

  • Number of processes, N=5N = 5
  • Maximum resource requirement of each process, Max(Pi)=2Max(P_i) = 2

A process can be blocked only if it has acquired 11 resource and is waiting for its 2nd2^{\text{nd}} resource. The worst-case allocation where a deadlock occurs is when every process is allocated 11 resource less than its maximum requirement, and no resources are left free in the system.

Worst-case allocated resources=∑i=1N(Max(Pi)−1)=5×(2−1)=5\text{Worst-case allocated resources} = \sum_{i=1}^{N} (Max(P_i) - 1) = 5 \times (2 - 1) = 5

If the total number of resources k=5k = 5, each of the 55 processes can hold 11 resource and wait indefinitely for another, resulting in a deadlock.

To guarantee that the system is deadlock-free, we must have at least one additional resource so that at least one process can satisfy its maximum demand, complete its execution, and release its allocated resources:

k≥∑i=1N(Max(Pi)−1)+1k \ge \sum_{i=1}^{N} (Max(P_i) - 1) + 1

k≥5+1=6k \ge 5 + 1 = 6

Thus, the minimum value of kk for the system to be deadlock-free is 6.

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

Published
Report a correction
Keep exploringMore Deadlock questions