Skip to main content

GATE CSE 2019Operating System › Deadlocks & Resource AllocationVerified

GATE CSE 2019 PYQ: Consider the following snapshot of a system running n n n concurrent processes. Process i i i is holding X i…

Consider the following snapshot of a system running nn concurrent processes. Process ii is holding XiX_i instances of a resource RR, 1≤i≤n1 \leq i \leq n. Assume that all instances of RR are currently in use. Further, for all ii, process ii can place a request for at most YiY_i additional instances of RR while holding the XiX_i instances it already has. Of the nn processes, there are exactly two processes pp and qq such that Yp=Yq=0Y_p = Y_q =0. Which one of the following conditions guarantees that no other process apart from pp and qq can complete execution?

  1. A
    Xp+Xq<Min{Yk∣1≤k≤n,k≠p,k≠q}X_p + X_q < \text{Min} \{Y_k \mid 1 \leq k \leq n, k \neq p, k \neq q \}
    Correct answer
  2. B
    Xp+Xq<Max{Yk∣1≤k≤n,k≠p,k≠q}X_p + X_q < \text{Max} \{Y_k \mid 1 \leq k \leq n, k \neq p, k \neq q \}
  3. C
    Min(Xp,Xq)≥Min{Yk∣1≤k≤n,k≠p,k≠q}\text{Min}(X_p,X_q) \geq \text{Min} \{Y_k \mid 1 \leq k \leq n, k \neq p, k \neq q\}
  4. D
    Min(Xp,Xq)≤Max{Yk∣1≤k≤n,k≠p,k≠q}\text{Min}(X_p,X_q) \leq \text{Max} \{Y_k \mid 1 \leq k \leq n, k \neq p, k \neq q\}

Answer

(A) X p + X q < Min { Y k ∣ 1 ≤ k ≤ n , k ≠ p , k ≠ q } X_p + X_q < \text{Min} \{Y_k \mid 1 \leq k \leq n, k \neq p, k \neq q \} X p ​ + X q ​ < Min { Y k ​ ∣ 1 ≤ k ≤ n , k  = p , k  = q }

Approach

Determine how many resources become available after processes p and q finish, then check whether that amount is insufficient for every other process's maximum remaining request.

Once p and q finish, only $X_p+X_q$ instances of $R$ become available. To guarantee that no other process can complete, every other process must require more than this amount, i.e. $X_p+X_q \&lt; \min_{k\neq p,q} Y_k$. Thus option A is correct.

Reviewed by GateIQ Editorial Team: IIT & IISc Alumni.