Deadlock · Operating System
23 questions · asked in 17 of 27 years (2000–2026)
MCQ 17 · MSQ 3 · NAT 31-mark 11 · 2-mark 12
Questions 11–15 of 23
There are 3 units of type X, 2 units of type Y and 2 units of type Z still available. The system is currently in a safe state. Consider the following independent requests for additional resources in the current state:
REQ1: P0 requests 0 units of X, 0 units of Y and 2 units of Z
REQ2: P1 requests 2 units of x, 0 units of Y and 0 units of Z
Which one of the following is TRUE?
Answer: (B)
- REQ1 (P0 takes 0,0,2): available is (3,2,0). P1 can finish (6,4,0). Then P0 (needs X = 8) and P2 (needs Z = 2) both cannot run unsafe, deny.
- REQ2 (P1 takes 2,0,0): available is (1,2,2). P1 needs (1,0,0) finishes (6,4,2). P2 runs (8,5,3). P0 runs safe, grant.
Answer: Only REQ2 can be permitted
Answer: 7
If the system has one more tape, one program can get it and finish. It then releases its tapes, so 6 + 1 = 7.
Answer: 7
if (i%2= = 0) {
if (in) request ;
if (i+2n)request ;
}
else {
if (in) request ;
if (i+2n)request ;
} In which one of the following situations is a deadlock possible?Answer: (B)
- n = 21, k = 12: i = 8 and j = 11 work deadlock is possible.
- n = 40 or n = 20: j = n i 2 is even not possible.
- n = 41, k = 19: i + j = 39, so one of them must be 20 not possible.
Answer: n = 21, k = 12
Which one of the following statements is TRUE if all three processes run concurrently starting at time t=0?
Answer: (A)
Resources: R1 = 3, R2 = 2, R3 = 3, R4 = 2. The table shows the free units after the events at each time.
At , process has to wait, because only is free but needs . So is blocked.
P1 was blocked from to , so all its later steps move 2 time units later. Its release of R2 and R1 (listed at ) happens at , its release of R3 (listed at ) at , and its request for (listed at ) at . P1 then finishes at instead of . P2 finishes at and P3 at .
Every request is met in the end, so all three processes finish and no process is in deadlock.
Answer: (A)
Answer: (B)
But each time the process needs something new, it gives up everything it holds and must ask again. Other processes may take those resources in the meantime, and the process may wait for them without end. So starvation can occur. Resources may also be used poorly, since the process releases them before it has used them fully.
Answer: (B)
Keep practising