Consider the following snapshot of a system running n processes. Process i is…

2006

Consider the following snapshot of a system running n processes. Process i is holding Xi instances of a resource R, 1 <= i <= n. currently, all instances of R are occupied. Further, for all i, process i has placed a request for an additional Yi instances while holding the Xi instances it already has. There are exactly two processes p and q such that Yp = Yq = 0. Which one of the following can serve as a necessary condition to guarantee that the system is not approaching a deadlock?

  1. A.

    min (Xp, Xq) < max (Yk) where k != p and k != q

  2. B.

    Xp + Xq >= min (Yk) where k != p and k != q

  3. C.

    max (Xp, Xq) > 1

  4. D.

    min (Xp, Xq) > 1

Attempted by 16 students.

Show answer & explanation

Correct answer: B

To guarantee the system is not approaching a deadlock, at least one process must be able to complete its execution and release resources. Processes p and q have no further requests (Y_p = Y_q = 0), so they can terminate immediately upon receiving their held resources. Upon termination, they release X_p + X_q instances of resource R. For the system to avoid deadlock, these released resources must be sufficient to satisfy the minimum remaining request of any other process. Therefore, the necessary condition is X_p + X_q >= min(Y_k) for all k != p, q.

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

Explore the full course: Gate Guidance By Sanchit Sir