Deadlocks & Their Prevention MCQs with Answers
What is a deadlock in an operating system?
a) A state where processes execute indefinitely
b) A state where a process cannot proceed due to blocking
c) A state where processes wait indefinitely
d) A state where processes do not interact
Which of the following is a necessary condition for a deadlock to occur?
a) Mutual exclusion
b) No preemption
c) Circular wait
d) All of the above
Which method is used for deadlock prevention by removing the circular wait condition?
a) Lock ordering
b) Resource allocation graph
c) Wait-for graph
d) Mutual exclusion
What is the deadlock prevention technique that ensures resources can be preempted?
a) Resource allocation graph
b) No preemption
c) Mutual exclusion
d) Preemptive resource allocation
Which of the following strategies can be used to avoid deadlocks?
a) Deadlock detection
b) Resource allocation graph
c) Priority-based scheduling
d) All of the above
Which of the following is a characteristic of deadlock avoidance?
a) Ensuring that at least one of the deadlock conditions is violated
b) Ensuring that resources are never allocated
c) Always allowing processes to run to completion
d) Preventing mutual exclusion
Which of the following is a method for deadlock detection?
a) Periodic checks for cyclic wait conditions
b) Resource allocation graph analysis
c) Detection algorithms
d) Locking resources
Which of the following is an example of a deadlock prevention strategy?
a) Allowing circular wait conditions
b) Using a resource allocation graph
c) Locking resources one at a time
d) Allocating resources freely
Which of the following is not a necessary condition for a deadlock?
a) Mutual exclusion
b) Circular wait
c) Preemptive resource allocation
d) Hold and wait
Which strategy involves ensuring that resources are allocated in a way that avoids deadlocks?
a) Deadlock detection
b) Deadlock prevention
c) Deadlock recovery
d) None of the above
What is the main advantage of the deadlock avoidance strategy?
a) No need for periodic checks
b) It ensures that deadlocks never occur
c) It requires frequent process restarts
d) It reduces system overhead
Which of the following is a technique used in deadlock prevention?
a) Avoiding resource allocation cycles
b) Allowing resource requests in any order
c) Limiting the number of processes
d) Limiting the number of resources
What is the role of the “wait-for graph” in deadlock detection?
a) It tracks process priority
b) It checks for cycles in the resource allocation
c) It indicates if a process is preempted
d) It tracks resource usage
Which deadlock prevention technique ensures that a process cannot hold multiple resources?
a) Resource allocation graph
b) Single resource request
c) Priority scheduling
d) Hold and wait prevention
Which algorithm is used for deadlock detection?
a) Banker’s algorithm
b) Wait-for graph algorithm
c) Locking mechanism
d) Resource request algorithm
What is the primary aim of deadlock recovery?
a) To prevent resource allocation cycles
b) To break a deadlock and resume process execution
c) To detect the occurrence of a deadlock
d) To reduce process priority
Which of the following is an advantage of deadlock detection?
a) It prevents the occurrence of deadlocks
b) It allows processes to proceed freely
c) It can remove deadlocks once they occur
d) It eliminates the need for resource allocation
Which of the following is a disadvantage of deadlock prevention?
a) High system overhead
b) It can lead to inefficient resource utilization
c) It may not be effective in large systems
d) It always requires constant resource monitoring
What does the “Banker’s algorithm” do in deadlock avoidance?
a) Allocates resources based on priority
b) Simulates resource allocation to avoid unsafe states
c) Tracks resource usage for better management
d) Detects deadlocks after they occur
Which of the following actions is commonly taken to break a deadlock in a recovery strategy?
a) Terminate one or more processes involved in the deadlock
b) Deny further resource requests
c) Rollback all processes to their initial states
d) Increase system memory
Which is a characteristic of deadlock recovery techniques?
a) They allow deadlocks to occur but ensure that they can be resolved later
b) They attempt to prevent deadlocks from occurring
c) They prioritize process completion over resource allocation
d) They remove deadlocks without interrupting processes
What is an advantage of the “no preemption” condition for deadlock prevention?
a) It minimizes system overhead
b) It allows processes to run uninterrupted
c) It ensures resources are always available
d) It simplifies process scheduling
Which of the following is true about a deadlock in a system?
a) It is caused by a lack of resources
b) It occurs when processes compete for resources in an unsafe manner
c) It can only happen if processes are actively interacting
d) It can be eliminated by increasing system resources
Which condition does the “hold and wait” condition describe in the context of deadlocks?
a) A process holding some resources and requesting additional resources
b) A process waiting for another process to release resources
c) A process holding resources and unable to proceed
d) A process holding resources indefinitely
What does the “Circular wait” condition in deadlocks refer to?
a) A process waiting for another process that has already waited for it
b) A process holding resources and waiting for new ones
c) Processes holding resources in a circular chain without proceeding
d) Processes waiting for resources without acquiring them
Which method can prevent deadlock caused by the “no preemption” condition?
a) Resource ordering
b) Forcefully terminating processes
c) Allowing resource sharing
d) Preemptively reallocating resources
What is the goal of a deadlock avoidance system?
a) To avoid resource allocation cycles
b) To prevent processes from requesting resources
c) To ensure resources are always available
d) To minimize memory usage