Chapter 5: Deadlock Flashcards
Resource Allocation Graph
shows the current allocation of resources to processes and the current requests by processes for new resources
A processes p is blocked if? (resource allocation graph)
on a resource r if one or more request edges directed from p to r exist and r does not contain sufficient free units to satisfy all requests.
Resource request (req r, m) by process p for m units of resource r
Creates m new edges directed from p to r. Only happens when:
- Process p has no unsatisfiable requests and thus is not blocked. A blocked process is not running and cannot issue additional requests.
- The number m of request edges plus the number k of allocation edges between a process and a resource must not exceed the total number of units of the resource. Exceeding m + k implies erroneous code, where a process failed to perform a release prior
resource acquisition (acq r, m) by process p of m units of resource r
reverses the direction of the corresponding request edges to point from the units of r to p. No partial allocations are allowed.
resource release (rel r, m) by process p of m units of resource r
deletes m allocation edges between p and r. Only happens when:
- Process p has no unsatisfiable requests and thus is not blocked.
- the number m of units to be released must not exceed the total number of units p is currently holding.
deadlock (state)
no matter what state transitions occur in the future, the process remains blocked
deadlock state
state that contains two or more deadlocked processes
safe state
State where no sequence of state transitions exists that would lead from the current state to a deadlock state.
Graph Reduction Algorithm
Repeat until no unblocked process remains in the graph:
- Select an unblocked process p.
- Remove p, including all request and allocation edges connected to p.
Completely Reducible (graph)
A graph where at the end of the graph reduction algorithm all processes have been deleted.
Theorem 1 (reducibility of graphs)
A state s is a deadlock state if and only if the resource graph of s is not completely reducible.
Theorem 2 (reducibility of graphs)
All reduction sequences of a given resource allocation graph lead to the same final graph.
Continuous deadlock detection (algorithm)
If the current operation is a request for a resource and the requesting process p becomes blocked in s’ then execute the graph reduction algorithm until
- either p is removed from the graph
- or no unblocked process remains in the graph
wait-for graph
A resource allocation graph containing only processes where each process can have multiple incoming resource allocation edges but only one outgoing resource request edge.
Theorem (wait-for graph)
A cycle in the wait-for graph is a necessary and sufficient condition for deadlock.