GATE / CS ARCHIVE

GATE CSE 2005 / QUESTION 71

Sufficient condition preventing resource deadlock

Operating Systems · Deadlocks · Full GATE CSE 2005 paper

GATE 2005, Q71 2 marks · MCQ
Report issue

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