Deadlock · Operating System
23 questions · asked in 17 of 27 years (2000–2026)
MCQ 17 · MSQ 3 · NAT 31-mark 11 · 2-mark 12
2000Questions per year2026
Questions 16–20 of 23
Which of the following is NOT true of deadlock prevention and deadlock avoidance schemes?
Answer: (A)
(A) is NOT true. Deadlock prevention only makes sure that one of the four necessary conditions can never hold. For example, resources are numbered and must be requested in order. Such a rule can refuse a request even when the resulting state is safe. So it is wrong to say that prevention always grants the request when the state is safe.
(B) True. Deadlock avoidance (for example the Banker's algorithm) checks whether the resulting state is safe, and grants the request if it is.
(C) True. Avoidance refuses a request only when the state would become unsafe, but prevention refuses more requests. So avoidance is less restrictive.
(D) True. To test for a safe state, avoidance needs the maximum resource needs of every process in advance.
Answer: (A)
(B) True. Deadlock avoidance (for example the Banker's algorithm) checks whether the resulting state is safe, and grants the request if it is.
(C) True. Avoidance refuses a request only when the state would become unsafe, but prevention refuses more requests. So avoidance is less restrictive.
(D) True. To test for a safe state, avoidance needs the maximum resource needs of every process in advance.
Answer: (A)
A single processor system has three resource types X, Y and Z, which are shared by three processes. There are 5 units of each resource type. Consider the following scenario, where the column alloc denotes the number of units of each resource type allocated to each process, and the column request denotes the number of units of each resource type requested by a process in order to complete execution. Which of these processes will finish LAST?
Answer: (C)
Allocated in total: X = , Y = , Z = . There are units of each type, so
Available .
Request vectors: P0 , P1 , P2 .
- Only P1 can run now: . P0 needs 1 X and P2 needs 1 X, but X = 0. P1 finishes and releases , so Available .
- P0: , so it can run. P2: needs 2 Y but only 1 is free, so it must wait. P0 finishes and releases , so Available .
- P2: , so it runs and finishes.
The order is P1, P0, P2, with no deadlock. So P2 finishes last.
Answer: (C)
Available .
Request vectors: P0 , P1 , P2 .
- Only P1 can run now: . P0 needs 1 X and P2 needs 1 X, but X = 0. P1 finishes and releases , so Available .
- P0: , so it can run. P2: needs 2 Y but only 1 is free, so it must wait. P0 finishes and releases , so Available .
- P2: , so it runs and finishes.
The order is P1, P0, P2, with no deadlock. So P2 finishes last.
Answer: (C)
Consider the following snapshot of a system running n processes. Process i is holding instances of a resource R, for . Currently, all instances of R are occupied. Further, for all i , process i has placed a request for an additional , instances while holding the instances it already has, There are exactly two processes p and q such that ==0. Which one of the following can serve as a necessary condition to guarantee that the system is not approaching a deadlock?
Answer: (B)
All instances of R are occupied, so nothing is free now. and ask for nothing more (), so both can finish and release their units. Then the free units are .
Any other process needs more units. If even the smallest of these is more than , no other process can ever proceed, and they are in deadlock. So we must have . This is a necessary condition, and it is option (B). It only guarantees that the system can move on from its present state, not that no deadlock arises later.
The other options are not necessary. Take three processes with , and a third process with . After and finish, units are free, so can finish and there is no deadlock. Yet in this case (so C fails) and (so D fails). Next take , : there is no deadlock, but (so A fails).
Answer: (B)
Any other process needs more units. If even the smallest of these is more than , no other process can ever proceed, and they are in deadlock. So we must have . This is a necessary condition, and it is option (B). It only guarantees that the system can move on from its present state, not that no deadlock arises later.
The other options are not necessary. Take three processes with , and a third process with . After and finish, units are free, so can finish and there is no deadlock. Yet in this case (so C fails) and (so D fails). Next take , : there is no deadlock, but (so A fails).
Answer: (B)
Two shared resources and are used by processes and . Each process has a certain priority for accessing each resource. Let denote the priority of for accessing . A process can snatch a resource from process if is greater than .
Given the following :
(I).
(II).
(III).
(IV).
Which of the following conditions ensures that and can never deadlock?
Given the following :
(I).
(II).
(III).
(IV).
Which of the following conditions ensures that and can never deadlock?
Answer: (C)
Snatch rule: can take from only if . A process that can snatch any resource it needs never waits for the other one, so it cannot be in a deadlock.
(C) (I) and (II): and . So has the higher priority on both resources and can snatch either from . It will finish and release all its resources, and then can proceed. No deadlock.
(A) (I) and (IV): holds and waits for , which holds. cannot snatch it because . waits for and cannot snatch it because . Both wait for each other, so this is a deadlock.
(B) (II) and (III): holds and waits for , which holds. cannot snatch it because . waits for and cannot snatch it because . So a deadlock can occur here too.
Answer: (C)
(C) (I) and (II): and . So has the higher priority on both resources and can snatch either from . It will finish and release all its resources, and then can proceed. No deadlock.
(A) (I) and (IV): holds and waits for , which holds. cannot snatch it because . waits for and cannot snatch it because . Both wait for each other, so this is a deadlock.
(B) (II) and (III): holds and waits for , which holds. cannot snatch it because . waits for and cannot snatch it because . So a deadlock can occur here too.
Answer: (C)
Suppose n processes, share m identical resource units, which can be reserved and released one at a time. The maximum resource requirement of process is , where . Which one of the following is a sufficient condition for ensuring that deadlock does not occur?
Answer: (C)
Deadlock needs all units to be held while every process still needs more. A process that is still waiting holds at most units. So all processes together hold at most units.
If this is less than , at least one unit is always free. Then some process can get its last unit, finish and release everything, and the rest can finish the same way. So no deadlock if
.
Why the others fail (take and every ): each process holds 1 unit, none is free, and each needs one more, so this is a deadlock. Yet (A) and (B) both hold. For (D), also holds, so (D) is not enough either.
Answer: (C)
If this is less than , at least one unit is always free. Then some process can get its last unit, finish and release everything, and the rest can finish the same way. So no deadlock if
.
Why the others fail (take and every ): each process holds 1 unit, none is free, and each needs one more, so this is a deadlock. Yet (A) and (B) both hold. For (D), also holds, so (D) is not enough either.
Answer: (C)
Keep practising