GATE / CS ARCHIVE

SIMILAR QUESTIONS / OPERATING SYSTEMS

Bound resource supply to guarantee deadlock freedom

8 questions solved the same way, newest first. Back to Operating Systems

How these are solved

Each asks a guaranteed deadlock-free bound for reusable identical instances with maximum process claims. Construct the worst unfinished holding sum(maximum_i-1), then require one extra instance; invert this inequality when asked for process count or maximum claim.

1 mark · NAT
Report issue

Resources needed to rule out deadlock

Deadlocks

Question 35, GATE 2026: Five processes share k identical resource instances. Each process needs at most two, requests or releases only one at a time, and can request its second only after receiving its first. Find the smallest k guaranteeing freedom from resource deadlock.
Tap to enlarge
Answer & solution

Official answer: 6

Givens and goal

Five processes share k identical resource instances. Each process needs at most two, requests or releases only one at a time, and can request its second only after receiving its first. Find the smallest k guaranteeing freedom from resource deadlock.

Approach

Show an unsafe allocation for too few resources and prove that one additional resource always lets some process finish.

Step-by-step solution

1. With k=5, allocate one instance to each process. If all five then request a second, all five available instances are held and every process is waiting. No process can reach its maximum claim and finish: this is a possible deadlock.
2. Smaller positive capacities also fail to give a universal guarantee: the available instances can each be held by a different process waiting for its second, while the others wait for their first. Thus merely showing failure at five is consistent with the lower-capacity cases.
3. Now let k=6. If some process holds two instances, it has its complete maximum resource requirement and can finish without waiting for another instance, then release what it holds.
4. Otherwise each of the at most five processes holds at most one instance, so at most five are allocated. At least one of the six remains free. It can be granted as a second instance to a waiting holder, enabling that process to finish and release two.
5. Repeating the reasoning gives a safe sequence of completions, so a resource deadlock cannot arise. The smallest required capacity is 6.

This is the standard resource-deadlock model, assuming a process eventually completes when its maximum resource need is satisfied. It does not guarantee fair scheduling or rule out starvation caused by a scheduler.

Original paper, page 24 · Answer key

1 mark · NAT
Report issue

Resource bound preventing deadlock

Deadlocks

Question 24, GATE 2018: Three processes share four identical resource instances. Each can need at most K, requesting and releasing one at a time. Find the largest K guaranteeing no deadlock.
Tap to enlarge
Answer & solution

Official answer: 2

Method

If every unfinished process has fewer than its maximum requirement, each may hold at most K−1 while waiting for another instance. With K=2, three such waiting processes can hold at most three resources, leaving the fourth available to let one finish. Releasing its resources then enables the others. For K=3, a feasible allocation (2,1,1) consumes all resources while each process can still request one; no request can be granted. This supplies both safety and a tight counterexample.

Solution

For n=3 processes each requiring at most K identical resources, a sufficient and tight universal bound is R≥n(K−1)+1: for K=2, any allocation in which all three processes still need another instance leaves at least one of the four resources free; for K=3 the allocation (2,1,1) can instead exhaust all resources with all processes waiting. With R=4, K=2 satisfies 4≥4, while K=3 permits holdings2, 1, 1 and all waiting. Thus the largest guaranteed-safe K is 2, assuming completed processes release their resources.

Original paper, page 10 · Answer key

2 marks · NAT
Report issue

Asked again GATE 1997, Q6.7 (different numbers)

Deadlocks

Question 31, GATE 2014: Three programs each require three tape units to operate. What is the minimum number of tape units that guarantees no resource deadlock?
Tap to enlarge
Answer & solution

Official answer: 7

Step 1: Exhibit a deadlock with six units: each program holds two and waits for a third, leaving no free unit and no program able to finish. Thus six is insufficient. Step 2: With seven units, if no program yet holds its full requirement, each holds at most two and together they hold at most six. At least one unit remains available to let some program reach three and finish. Step 3: Its release permits the others to progress. Hence the minimum is 3(3−1)+1=7 under the usual reusable-resource model, maximum demand of three, and eventual completion/release once the demand is met.

Original paper, page 60 · Answer key

2 marks · MCQ
Report issue

Sufficient condition preventing resource deadlock

Deadlocks

Question 71, GATE 2005: n processes share m identical reusable units, acquired/released one at a time. Process i has positive maximum need s_i. Which is sufficient to avoid resource deadlock? A every s_i<m; B every s_i<n; C Σs_i<m+n; D Σs_i<m·n.
Tap to enlarge
Your answer
Answer & solution

Answer: C (no official key was published)

If no process can finish, every process can hold at most si−1 units while still needing another unit. Thus at most sum(si−1)=sum(si)−n units can be held in an all-unfinished configuration. If sum(si)<m+n, this total is less than m, so at least one resource is free; allocating available units eventually lets a process reach its maximum and finish. Release its resources and repeat. Equivalently m>sum(si−1) guarantees progress for the single resource type. This is option C.

Suppose every unfinished process is blocked below its maximum claim. It can hold at most si−1 units, so together they can hold at mostΣ(si−1). If m exceeds that bound, some units remain available and can be allocated until at least one process finishes; its release only improves the position. Rearranging m>Σsi−n gives option C. Individual small claims alone do not prevent circular waiting among multiple processes.

Original paper, page 9

1 mark · MCQ
Report issue

Asked again GATE 1992, Q2(xi) (different numbers)

Deadlock-free tape-drive bound

Deadlocks

Question 1.32, GATE 1998: Six identical tape drives are shared by n processes, each needing at most two. Find the largest n guaranteeing no resource deadlock among 6, 5, 4, 3.
Tap to enlarge
Your answer
Answer & solution

Answer: B: 5 under unrestricted incremental allocation (no official key was published)

The dangerous state gives each process one drive while it waits for a second. With n≤5, at least one of six drives remains free, so some waiting process can receive its second, finish and release both; repeat to complete others. With n=6, all six can hold one and wait forever for a second, producing deadlock. Therefore the largest guaranteed-safe n is 5, B. This is a worst-case allocation guarantee, assuming eventual release and no other resources; an avoidance policy could safely serialize more processes.

Original paper, page 3

2 marks · MCQ
Report issue

Asked again GATE 2014 Set 3, Q31 (different numbers)

Resource count excluding deadlock

Deadlocks

Question 6.7, GATE 1997: Three processes each may require two units of one resource. Minimum units guaranteeing no allocation deadlock among 3, 5, 4, 6?
Tap to enlarge
Your answer
Answer & solution

Answer: C: 4 (no official key was published)

With only three units, each process can hold one and wait for a second, creating deadlock. With four units, if all unfinished processes hold at most one, at least one unit remains available to give some process its second. It can finish and release its units, after which the argument repeats. Therefore four is sufficient and three can fail, so C. This is the standard worst-case incremental-allocation guarantee with eventual completion and no other resources; a restrictive admission policy could safely serialize processes with fewer units.

Original paper, page 6

2 marks · MSQ
Report issue

Resource supply guaranteeing no deadlock

Deadlocks

Question 7.9, GATE 1993: Three processes have maximum same-resource demands 3,4,6. Among m=7,9,10,13,15,which supplies guarantee no resource deadlock?
Tap to enlarge
Select all that apply
Answer & solution

Answer: D,E: 13 and 15; exact threshold 11 (no official key was published)

If all three unfinished processes hold one less than their maxima, they can hold 2+3+5=10 units and still each request another. Thus ten units can deadlock, and smaller listed supplies can also be exhausted among unsatisfied processes. With eleven units, at least one additional unit is available whenever all processes are below their maxima, enabling some process to reach its demand, finish and release resources. Repeating resolves the rest. Therefore every supply at least eleven is safe under the standard completion model; the listed qualifying values are 13 and 15, not only the smaller of them.

Original paper, page 8

Report issue

Asked again GATE 1998, Q1.32 (different numbers)

Maximum process count with six drives

Deadlocks

Question 2(xi), GATE 1992: Six identical tape drives are shared by n processes, each possibly needing three. What maximum n guarantees no resource deadlock without restrictive allocation?
Question 2(xi), GATE 1992: Six identical tape drives are shared by n processes, each possibly needing three. What maximum n guarantees no resource deadlock without restrictive allocation?
Tap to enlarge
Select all that apply
Answer & solution

Answer: A: n=2 (no official key was published)

A worst-case deadlock can have every process hold two drives and wait for its third. To rule that out for n processes, at least 2n+1 drives suffice under the standard completion model. With six drives, this requires n≤2. For three processes, each can hold two, exhausting all six and waiting forever. For two processes, their combined maximum demand is six, so both can be fully satisfied. The guarantee assumes eventual completion after required resources are granted and no additional resource types or faulty nontermination.

Original paper, page 3