COMP 322 Chapter 5 Deadlock Flashcards
Learn about deadlock
Resource allocation graph
Shows the current allocation of resources to processes and the current requests by processes for new resources.
Process state blocked
A process is blocked on 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.
State transitions: A resource request
A process p from m units of a resource r creates m new edges directed from p to r.
They can only be issued only when:
1. Process p has no unsatisfied requests and it is not blocked. A blocked process is not running any additional requests.
- The number m of request edges plus the k of allocation edges between a process and a resource must not exceed the total amount units of the resource
State transitions: A resource acquisition
a process resource r reverses the direction of the corresponding request edges to point from the units r to p.
It is allowed only when r currently contains the least m free units.
State transitions: A resource release
Operation by process p of m units of a resource r deletes the m allocation edges between p and r.
Only occurs when:
1. Process p has no unsatisfied requests and it is not blocked.
2. The number of m of units to be released must not exceed the total number of units p is currently holding.
Deadlocked
if the process is blocked in a state s and if no matter state transitions occur in the future, the process remains blocked.
Deadlock state
A state s where s contains two or more deadlock processes.
Safe state
A state s where if no sequence of state transitions exists that would lead from s to a deadlock state.
Deadlock detection (Graph reduction)
A deadlock in a resource allocation graph can be detected by executing a graph reduction algorithm.
Completely reducible
if at the termination of the graph reduction algorithm all processes have been deleted.
Wait-for graph
A resource allocation graph containing only processes where each process can have multiple incoming resource allocation edges between one outgoing resource request edge.
A process is blocked on a resource that is currently held by another process.
Maximum claim
The set of all resources the process may ever request.
Each potential future claim is represented by a dashed edge in the resource allocation graph.
Resource claim graph
It is an extension of a general resource allocation graph.
The extended graph shows:
The current allocation of resources to processes.
All current and all potential future requests by processes for new resources.
The banker’s algorithm: (What is it)
Emulates the strategy used by a bank when issuing loans.
A loan corresponds to a resource allocation and maximum claim corresponds to the credit limit of a customer (requesting process).
The banker’s algorithm: (How it works)
1- Given a resource request in a state s, temporarily grants the request by changing the request edges to allocation edges.
2- Execute a graph reduction on the new state s’. (Claim edges are treated as request edges.)
3- If the graph of state s’ is completely reducible then accept s’ as the new state. Otherwise disallow the acquisition by reverting to state s.