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 1–5 of 23
With respect to deadlocks in an operating system, which of the following statements is/are FALSE?
One or more options are correct.
Answer: (A), (C)
Let us check each statement about deadlocks:
- "Banker's algorithm is used to prevent deadlocks" — FALSE. Banker's algorithm is a deadlock-avoidance algorithm. It checks resource requests as they come, so the system stays in a safe state. Deadlock prevention means different techniques. They remove one of the four necessary conditions (mutual exclusion, hold-and-wait, no pre-emption, circular wait).
- "Deadlock formation can be prevented by disallowing hold-and-wait" — true. This is a standard deadlock-prevention technique, because one of the four necessary conditions is removed.
- "An assignment edge in a resource-allocation graph is marked from a process to a resource" — FALSE. It is the other way round. An assignment edge goes from a resource to a process, which means the resource is given to the process. A request edge goes from a process to a resource.
- "A safe state guarantees all processes can finish without deadlock" — true. This is exactly what a safe state means.
Answer (the FALSE statements): "Banker's algorithm prevents deadlocks", and "an assignment edge goes from process to resource."
- "Banker's algorithm is used to prevent deadlocks" — FALSE. Banker's algorithm is a deadlock-avoidance algorithm. It checks resource requests as they come, so the system stays in a safe state. Deadlock prevention means different techniques. They remove one of the four necessary conditions (mutual exclusion, hold-and-wait, no pre-emption, circular wait).
- "Deadlock formation can be prevented by disallowing hold-and-wait" — true. This is a standard deadlock-prevention technique, because one of the four necessary conditions is removed.
- "An assignment edge in a resource-allocation graph is marked from a process to a resource" — FALSE. It is the other way round. An assignment edge goes from a resource to a process, which means the resource is given to the process. A request edge goes from a process to a resource.
- "A safe state guarantees all processes can finish without deadlock" — true. This is exactly what a safe state means.
Answer (the FALSE statements): "Banker's algorithm prevents deadlocks", and "an assignment edge goes from process to resource."
Consider a system consisting of instances of a resource , being shared by processes. Assume that each process requires a maximum of two instances of resource and a process can request or release only one instance at a time. Further, a process can request the second instance of the resource only after acquiring the first instance.
The minimum value of for the system to be deadlock-free is ________. (answer in integer)
The minimum value of for the system to be deadlock-free is ________. (answer in integer)
Answer: 6
This question uses the standard resource-count rule for staying free of deadlock. Each of the processes needs at most instances of .
The system is deadlock-free if one process can always finish, even in the worst case. In the worst case, every process holds one instance and waits for its second. If at least one process can then get its second instance, it finishes and releases both. The other processes can then go on one after another.
Worst case: each of the processes already holds instance. This uses up instances. One more instance must be free, so that one waiting process can get its 2nd instance and complete.
So the minimum is .
Answer: 6
The system is deadlock-free if one process can always finish, even in the worst case. In the worst case, every process holds one instance and waits for its second. If at least one process can then get its second instance, it finishes and releases both. The other processes can then go on one after another.
Worst case: each of the processes already holds instance. This uses up instances. One more instance must be free, so that one waiting process can get its 2nd instance and complete.
So the minimum is .
Answer: 6
consists of all active processes in an operating system. consists of single instances of distinct types of resources in the system.
The resource allocation graph has the following assignment and claim edges.
(the assignment edge means resource is assigned to process , and so on for others)
(the claim edge means process is waiting for resource , and so on for others)
Which of the following statement(s) is/are CORRECT?
The resource allocation graph has the following assignment and claim edges.
(the assignment edge means resource is assigned to process , and so on for others)
(the claim edge means process is waiting for resource , and so on for others)
Which of the following statement(s) is/are CORRECT?
One or more options are correct.
Answer: (C), (D)
Draw the resource-allocation graph and check for cycles. Every resource has a single instance, so a cycle means deadlock.
Cycle A: , which involves .
Cycle B: , which involves .
Both cycles have in common. Aborting by itself breaks both cycles at the same time, because removing the edges of collapses both. The system becomes deadlock-free.
Aborting by itself breaks only Cycle A. Cycle B never involved , so it stays intact and the system is still deadlocked. In the same way, aborting by itself touches only Cycle A. Cycle B is left as it is, so the system is still deadlocked.
Aborting both and together: removing frees , so the wait of is resolved. Removing frees , so the wait of for is resolved. With both freed, the rest of the chain () can unwind fully. The system is deadlock-free.
Answer: Aborting P2 alone works; and aborting both P1 and P4 together works.
Cycle A: , which involves .
Cycle B: , which involves .
Both cycles have in common. Aborting by itself breaks both cycles at the same time, because removing the edges of collapses both. The system becomes deadlock-free.
Aborting by itself breaks only Cycle A. Cycle B never involved , so it stays intact and the system is still deadlocked. In the same way, aborting by itself touches only Cycle A. Cycle B is left as it is, so the system is still deadlocked.
Aborting both and together: removing frees , so the wait of is resolved. Removing frees , so the wait of for is resolved. With both freed, the rest of the chain () can unwind fully. The system is deadlock-free.
Answer: Aborting P2 alone works; and aborting both P1 and P4 together works.
Which of the following statements is/are TRUE with respect to deadlocks?
One or more options are correct.
Answer: (A), (D)
(A) TRUE. Circular wait is one of the four necessary conditions for deadlock. The others are mutual exclusion, hold and wait, and no preemption.
(B) FALSE. When resources have many instances, a cycle in the graph is necessary for deadlock but not enough. Another process outside the cycle may release an instance and break the wait.
(C) FALSE. An unsafe state may lead to deadlock, but not always. Processes may give back their resources early.
(D) TRUE. If every edge is an assignment edge, there is no request edge, so no process is waiting for anything. With no waiting, there is no deadlock.
Answer: (A), (D)
(B) FALSE. When resources have many instances, a cycle in the graph is necessary for deadlock but not enough. Another process outside the cycle may release an instance and break the wait.
(C) FALSE. An unsafe state may lead to deadlock, but not always. Processes may give back their resources early.
(D) TRUE. If every edge is an assignment edge, there is no request edge, so no process is waiting for anything. With no waiting, there is no deadlock.
Answer: (A), (D)
Consider the following snapshot of a system running n concurrent processes. Process is holding instances of a resource R, . Assume that all instances of R are currently in use. Further, for all , process can place a request for at most additional instances of R while holding the instances it already has. Of the n processes, there are exactly two processes p and q such that . Which one of the following conditions guarantees that no other process apart from p and q can complete execution?
Answer: (A)
Processes p and q ask for nothing more, so both can finish. They then give back instances. No instance is free before this, because all are in use.
Any other process k can complete only when it receives more instances. Now suppose . Then the freed instances are too few for any other process, so none of them can complete.
Answer:
Any other process k can complete only when it receives more instances. Now suppose . Then the freed instances are too few for any other process, so none of them can complete.
Answer:
Keep practising