(7) Deadlock Flashcards
When is a thread deadlocked?
When it’s waiting for an event to occur that can never occur.
What four conditions must be present for a deadlock to be possible?
Mutual exclusion
Hold and wait
No preemption
Circular wait
What happens if you have an -irreducible- cycle?
A deadlock occurs
When can a graph be reduced by a thread?
If all of that threads requests can be granted meaning that the thread will eventually terminate.
What are the (Hold, Havender) Miscellaneous theroems?
There are no deadlocked threads iff the graph is completely reducible
The order of reductions is irrelevant.
How would you prevent deadlocks by targeting the Mutual Exclusion requirement?
Don’t require mutual exclusion for shareable (e.g read-only) files; but do for non-shareable resources.
How would you prevent deadlocks by targeting the Hold and Wait requirement?
Guarantee that whenever a process requests a resource it does not hold any other resources.
How would you prevent deadlocks by targeting the No Preemption requirement?
If a process holding some resources requests another unavailable resource then all resources currently held are released.
Only restart process when it can regain its old resources as well as the newly requested ones.
How would you prevent deadlocks by targeting the Circular Wait requirement?
Impose a total ordering of all resource types and requires that each process requests resources in an increasing order of enumeration.
What is detect and recover?
Every once in a while check to see if there is a deadlock and if there is then remove it.
What is a Safe State?
If there is a sequence of ALL processes in the systems such that for every Pi the resources that Pi can still request can be satisfied by the currently available resources and the resources held by all Pj where j
What is the relation between unsafe states and deadlocks?
Deadlocks are a subset of unsafe states.
What is deadlock detection?
You allow the system to enter the deadlock state
Run the detection algorithm (waits-for with cycle detection)
Recover