Suppose n processes, P1, …. Pn share m identical resource units, which can be…

2005

Suppose n processes, P1, …. Pn share m identical resource units, which can be reserved and released one at a time. The maximum resource requirement of process Pi is Si, where Si > 0. Which one of the following is a sufficient condition for ensuring that deadlock does not occur?

Attempted by 127 students.

Show answer & explanation

Concept: For a single resource type with m identical units shared by n processes (each acquiring/releasing one unit at a time, with declared maximum need Si per process), a deadlocked process must still be short of its own maximum — otherwise it would already have everything it could ever need and would not be blocked. So in any deadlocked state, a process’s current holding ri satisfies ri < Si (i.e. ri ≤ Si − 1), and since every process is blocked, no unit can be sitting free — all m units must be allocated. Summing the per-process bound over all n processes turns this into one numeric test: whenever the declared maximum demands violate that sum, deadlock is impossible.

Application: derive the bound.

  1. Assume, for contradiction, that a deadlock occurs under this allocation scheme.

  2. Let ri be the number of units process Pi is holding at the instant of deadlock.

  3. Pi is blocked, so it still needs at least one more unit to reach its declared maximum Si; hence ri < Si, i.e. ri ≤ Si − 1 (whole units).

  4. Every process is blocked and none can proceed, so no unit can be free at that instant (a free unit would let some blocked request succeed); hence the m units are fully allocated: Σri = m.

  5. Summing the per-process bound over all n processes: Σri ≤ Σ(Si − 1) = ΣSi − n.

  6. Substituting Σri = m gives m ≤ ΣSi − n, i.e. ΣSi ≥ m + n.

  7. This contradicts an assumed condition ΣSi < m + n — so the deadlock assumed in step 1 cannot hold whenever ΣSi < m + n.

Cross-check (boundary example): take n = 3, m = 3, S1 = S2 = S3 = 2, so ΣSi = 6 = m + n exactly — the strict inequality just fails. Give each process 1 unit (all m = 3 units now allocated) and let each request one more: every process is blocked with no free unit, which is a genuine deadlock. This shows the bound is tight: the instant ΣSi stops being strictly less than m + n, a deadlock becomes constructible, confirming ΣSi < m + n is exactly the threshold that rules deadlock out.

Result: the sufficient condition for guaranteeing deadlock cannot occur is Σᵢ₌₁ⁿ Si < (m + n), i.e. the option ΣSi < (m + n).

Why the other three bounds fail: the same n = 3, m = 3, S1 = S2 = S3 = 2 deadlock above also satisfies ∀i, Si < m (2 < 3), ∀i, Si < n (2 < 3), and ΣSi < m·n (6 < 9) — yet the deadlock still happens. So none of the three per-process or product bounds prevents the scenario that the m + n bound rules out; only the m + n bound is violated at exactly this boundary, which is why it (and only it) is sufficient.

A video solution is available for this question — log in and enroll to watch it.

Explore the full course: Iocl Engineers Officers Grade A Paper 2

Loading lesson…