Deadlocks Flashcards
What is a deadlock?
A permanent blocking of a set of processes that are competing for resources
How do deadlocks occur?
- When 2 processes request the same resource that can’t be run twice at the same time
- When there is limited memory available and a process tries to request more memory than is available
What are the preconditions that will lead to a deadlock?
Mutual exclusion - only one process can use a resource at a time
Hold-and-wait - a process can hold resources while it is waiting for other resources to become available
What is a condition that will lead to a deadlock?
Circular wait - Processes wait for each other to release resources they want to acquire, they form a kind of “closed chain of processes”
How to handle deadlocks with deadlock prevention?
Avoid at least 1 of the 4 deadlock conditions
How to handle deadlocks with deadlock avoidance?
Resources are reserved in a way so they do not lead to a deadlock
How to handle deadlocks with deadlock detection?
- There is no restriction on resource allocation
- There is a periodic check to see if a deadlock is occurring
- In case a deadlock is detected, recovery mechanisms are employed