Consider the following snapshot of a system running n concurrent processes.…

2021

Consider the following snapshot of a system running n concurrent processes. Process i is holding Xi instances of a resource R, 1 ≤ i ≤ n. Assume that all instances of R are currently in use. Further, for all i, process i can place a request for at most Yi additional instances of R while holding the Xi instances it already has. Of the n processes, there are exactly two processes p and q such that Yp = Yq = 0. Which one of the following conditions guarantees that no other process apart from p and q can complete execution?

Answer: A. Xp + Xq < Min{Yk | 1 ≤ k ≤ n, k ≠ p, k ≠ q}Concept. This item uses the maximum-claim model of deadlock avoidance: every process declares the largest additional amount it may still request, and because…

  1. A.

    Xp + Xq < Min{Yk | 1 ≤ k ≤ n, k ≠ p, k ≠ q}

  2. B.

    Xp + Xq < Max{Yk | 1 ≤ k ≤ n, k ≠ p, k ≠ q}

  3. C.

    Min(Xp, Xq) ≥ Min{Yk | 1 ≤ k ≤ n, k ≠ p, k ≠ q}

  4. D.

    Min(Xp, Xq) ≤ Max{Yk | 1 ≤ k ≤ n, k ≠ p, k ≠ q}

  5. E.

    Question not attempted

Attempted by 282 students.

Show answer & explanation

Correct answer: A

Concept. This item uses the maximum-claim model of deadlock avoidance: every process declares the largest additional amount it may still request, and because the system cannot know in advance that a process will ask for less, a process counts as able to complete only when the free pool can cover that full declared amount. The pool itself grows only when some process finishes and hands back everything it was holding. To block an entire group of processes at once, compare the pool that will actually become available against the smallest declared demand in that group: a pool strictly below that minimum is strictly below every demand in the group, so no claim in the group can be granted — and because nothing finishes, no further release ever occurs and the pool never grows. That permanence is what turns a momentary shortage into a guarantee.

Applying it to this snapshot.

  1. All instances of R are already in use, so the free pool starts at 0. With no free instances, any process k whose declared outstanding demand Yk is greater than 0 cannot be granted its claim and is stuck immediately.

  2. Exactly two processes, p and q, have Yp = Yq = 0. They need nothing further, so they run to completion and hand back everything they hold. The free pool therefore becomes Xp + Xq.

  3. A remaining process k (k ≠ p, q) counts as able to finish only if that pool covers its full declared demand, that is only if Xp + Xq ≥ Yk; the worst case the model must assume is that k asks for all Yk at once.

  4. To block every remaining process at the same time we need Xp + Xq < Yk for all k ≠ p, q. A quantity lies below every member of a set exactly when it lies below the smallest member, so this collapses to Xp + Xq < Min{Yk | 1 ≤ k ≤ n, k ≠ p, k ≠ q}.

  5. Since nothing else can proceed, no further resources are ever released and the pool stays at Xp + Xq forever. The blockage is therefore permanent, which is exactly what “guarantees” demands.

Cross-check and contrast.

  • Comparing against the maximum instead: Xp + Xq < Max{Yk | k ≠ p, q} says only that the pool falls short of the single hungriest claim. Take a released pool of 3 with remaining demands Yr = 2 and Ys = 9 — here Max{2, 9} = 9, so 3 < 9 holds, yet the pool of 3 already covers r’s claim of 2 and r completes. The condition can hold while another process still finishes, so it guarantees nothing.

  • Using Min(Xp, Xq) in place of the sum: the pool that is actually released is Xp + Xq, not the smaller of the two holdings. Bounding Min(Xp, Xq) says nothing about how large Xp + Xq can be, so it cannot cap the pool.

  • Direction of the inequality: Min(Xp, Xq) ≥ Min{Yk | k ≠ p, q} makes a holding at least as large as a demand, which permits a process to be satisfied instead of blocking it, while Min(Xp, Xq) ≤ Max{Yk | k ≠ p, q} is almost always true and constrains nothing at all.

  • Numeric check: take n = 4 with Xp = 2, Xq = 1 and remaining demands Yr = 4, Ys = 9. The released pool is 3 and Min{4, 9} = 4, so 3 < 4 holds and neither r nor s can proceed. Lower Yr to 3 and the pool of 3 now covers r — and correspondingly 3 < Min{3, 9} = 3 is false.

Result. The guarantee is exactly Xp + Xq < Min{Yk | 1 ≤ k ≤ n, k ≠ p, k ≠ q}.

Explore the full course: Dsssb Tgt Computer Science Paper 2

Loading lesson…