A deadlock is a situation where a group of processes are each waiting for resources held by the others, so none can proceed.
Click to reveal answer
beginner
What is the main goal of deadlock detection?
The main goal of deadlock detection is to find if a deadlock has occurred in the system by checking resource allocation and process states.
Click to reveal answer
intermediate
Name one common method used for deadlock detection.
One common method is the resource allocation graph, which shows processes and resources and helps identify cycles indicating deadlocks.
Click to reveal answer
intermediate
What are two common strategies for deadlock recovery?
Two common strategies are: 1) Terminating one or more processes involved in the deadlock, 2) Preempting resources from some processes to break the deadlock.
Click to reveal answer
intermediate
Why is deadlock prevention often not used in practice?
Deadlock prevention can be too restrictive and reduce system efficiency because it limits how resources are allocated.
Click to reveal answer
What does a cycle in a resource allocation graph indicate?
AA deadlock
BA free resource
CA completed process
DAn idle CPU
✗ Incorrect
A cycle in the resource allocation graph means processes are waiting on each other in a loop, which is a deadlock.
Which of the following is NOT a deadlock recovery method?
ARolling back processes
BPreempting resources
CTerminating processes
DIgnoring the deadlock
✗ Incorrect
Ignoring the deadlock does not recover from it; recovery requires active steps like termination or preemption.
Deadlock detection algorithms typically run:
AOnly at system startup
BPeriodically during system operation
COnly when a process finishes
DNever
✗ Incorrect
Deadlock detection algorithms run periodically to check if deadlocks have occurred.
Which resource state is most likely to cause deadlock?
AResources held and requested simultaneously by processes
BResources always free
CResources never requested
DResources allocated to only one process
✗ Incorrect
Deadlocks happen when processes hold resources and wait for others held by other processes.
What is a disadvantage of terminating processes to recover from deadlock?
AIt prevents deadlocks from happening
BIt speeds up the system
CIt may cause loss of work done by the terminated processes
DIt frees all resources immediately
✗ Incorrect
Terminating processes can cause loss of progress and data from those processes.
Explain how deadlock detection works and what happens after a deadlock is detected.
Think about how the system finds deadlocks and what it does next.
You got /4 concepts.
Describe two methods used to recover from deadlocks and their possible drawbacks.
Consider what happens when you stop or take resources from processes.
You got /4 concepts.
Practice
(1/5)
1. What is the main purpose of deadlock detection in operating systems?
easy
A. To find when programs are stuck waiting forever
B. To speed up program execution
C. To allocate more memory to programs
D. To prevent viruses from entering the system
Solution
Step 1: Understand deadlock concept
Deadlock happens when programs wait forever for resources held by each other.
Step 2: Identify deadlock detection role
Deadlock detection finds these stuck programs so the system can fix the problem.
Final Answer:
To find when programs are stuck waiting forever -> Option A
Quick Check:
Deadlock detection = find stuck programs [OK]
Hint: Deadlock detection means finding stuck programs [OK]
Common Mistakes:
Confusing detection with prevention
Thinking it speeds up programs
Mixing with security tasks
2. Which of the following is a correct method used in deadlock recovery?
easy
A. Terminating one or more processes
B. Encrypting data
C. Adding more RAM
D. Increasing CPU speed
Solution
Step 1: Review deadlock recovery methods
Recovery fixes deadlocks by freeing resources or stopping processes causing the deadlock.
Step 2: Match options to recovery methods
Terminating processes is a common way to break deadlocks by releasing resources.
Final Answer:
Terminating one or more processes -> Option A
Quick Check:
Recovery = stop processes to free resources [OK]
Hint: Recovery often stops processes to free resources [OK]
Common Mistakes:
Thinking hardware upgrades fix deadlocks
Confusing recovery with detection
Believing encryption helps deadlocks
3. Consider a system with three processes P1, P2, P3 and resources R1, R2. If P1 holds R1 and waits for R2, P2 holds R2 and waits for R1, and P3 is idle, what does deadlock detection report?
medium
A. No deadlock detected
B. Deadlock involving P2 and P3
C. Deadlock involving P1 and P2
D. Deadlock involving all three processes
Solution
Step 1: Analyze resource holding and waiting
P1 holds R1 and waits for R2; P2 holds R2 and waits for R1; P3 is idle (not waiting).
Step 2: Identify circular wait
P1 and P2 are waiting on each other's resources, forming a cycle causing deadlock; P3 is not involved.
Final Answer:
Deadlock involving P1 and P2 -> Option C
Quick Check:
Circular wait between P1 and P2 = deadlock [OK]
Hint: Look for circular waiting processes [OK]
Common Mistakes:
Including idle processes in deadlock
Ignoring circular wait condition
Assuming no deadlock if one process is idle
4. A system uses a deadlock detection algorithm but never recovers from deadlocks. What is the main problem with this approach?
medium
A. Deadlocks will be prevented automatically
B. Deadlocks will never be found
C. System will run faster
D. System will detect deadlocks but remain stuck
Solution
Step 1: Understand detection without recovery
Detection finds deadlocks but does not fix them if recovery is missing.
Step 2: Identify system behavior
The system will know deadlocks exist but processes remain stuck, causing hang or freeze.
Final Answer:
System will detect deadlocks but remain stuck -> Option D
5. In a system with multiple processes and resources, which strategy best combines deadlock detection and recovery to maintain system fairness and efficiency?
hard
A. Prevent deadlocks by denying all resource requests
B. Detect deadlocks periodically and terminate the process holding the most resources
C. Ignore deadlocks and restart the system when it freezes
D. Allow deadlocks and manually fix them later
Solution
Step 1: Understand combined detection and recovery