Computer Sciences > GATE 2026 SET-1 > Deadlock
Consider a system consisting of 𝑘 instances of a resource 𝑅, being shared by 5 processes. Assume that each process requires a maximum of two instances of resource 𝑅 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 𝑘 for the system to be deadlock-free is ________. (answer in integer)

Correct : 6

The correct answer is 6.
This is a classic deadlock avoidance problem. The standard formula to find the minimum number of resource instances required to guarantee a deadlock-free environment is:
Minimum k = n × (m − 1) + 1
Where:
n = number of processes = 5
m = maximum instances any process can hold = 2
So: k = 5 × (2 − 1) + 1 = 5 × 1 + 1 = 6
Why does this work? The worst-case deadlock scenario is when every process holds (m−1) instances and is waiting for one more. With 5 processes each holding 1 instance, that''s 5 instances total consumed and every process stuck waiting. If k = 5, all instances are held with no process able to proceed - deadlock.
But with k = 6, even if all 5 processes each hold 1 instance (5 used), there is still 1 remaining instance. That extra instance can be given to one process, allowing it to acquire its second instance, complete, and release both. This chain reaction ensures all processes eventually finish - no deadlock possible.

Similar Questions

A system shares 9 tape drives. The current allocation and maximum requirement of tape drives for 3 processes are shown below: Process...
#158 MCQ
A multithreaded program P executes with x number of threads and uses y number of locks for ensuring mutual exclusion while operating on shared memory locations....
#172 MCQ
P={P1,P2,P3,P4} consists of all active processes in an operating system.R={R1,R2,R3,R4} consists of single instances of distinct types of resources in the syste...
#1455 MCQ

Related Topics

minimum resources deadlock free GATE 2026 GATE CS 2026 Set-1 Q18 5 processes 2 instances resource R deadlock free minimum k n processes m instances formula deadlock avoidance GATE operating system deadlock GATE circular wait prevention GATE

Unique Visitor Count

Total Unique Visitors

Loading......