Deadlock Prevention and Avoidance
Deadlock Prevention
Deadlock prevention involves ensuring that one of the necessary conditions for deadlock is not met.
Methods for Deadlock Prevention
- Mutual Exclusion: Make resources shareable.
- Hold and Wait: Ensure that a process never holds a resource and waits for another.
- No Preemption: Allow preemption of resources.
- Circular Wait: Order resources in a linear sequence.
Deadlock Avoidance
Deadlock avoidance involves using algorithms that predict whether a deadlock is possible.
Methods for Deadlock Avoidance
- Banker's Algorithm: Test for safety by simulating the allocation of resources.
- Resource Ordering: Order resources in a way that prevents circular waits.
Comparison | Deadlock Prevention | Deadlock Avoidance |
---|---|---|
Approach | Prevent one of the necessary conditions | Predict and avoid deadlocks |
Complexity | Less complex | More complex |
Resource Utilization | May lead to underutilization | Better resource utilization |
No comments:
Post a Comment