C191-Terms-Chapter-6 Flashcards
reusable resource
A reusable resource may be requested, acquired, and later released by a process. Ex: processors, devices, memory blocks, and files.
consumable resource
A consumable resource is created by a process and consumed by another process. Ex: messages, interrupts, or signals. This chapter deals with only reusable resources.
resource allocation graph
shows the current allocation of resources to processes and the current requests by processes for new resources.
Processes are represented by circles.
Resources are represented by rectangles. If a resource contains multiple units then each unit is represented by a small circle.
Resource allocations are represented by edges directed from a resource to a process.
Resource requests are represented by edges directed from a process to a resource.
blocked
A process p is blocked 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 a process p for m units of a resource, r creates m new edges directed from p to r. A resource request may be issued only 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 before a new request.
resource acquisition
(acq r, m) by a process, p of m units of a resource r reverses the direction of the corresponding request edges to point from the units of r to p.
A resource acquisition is executed by the system and is allowed only when r currently contains at least m free units. No partial allocation of units is permitted.
resource release
(rel r, m) operation by a process p of m units of a resource r deletes m allocation edges between p and r.
A resource release may be issued only 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.
deadlocked
A process is deadlocked in a state s if the process is blocked in s and if no matter what state transitions occur in the future, the process remains blocked.
deadlock state
A state s is called a deadlock state if s contains two or more deadlocked processes.
safe state
A state s is a safe state if no sequence of state transitions exists that would lead from s to a deadlock state.
When the sequence of all requests and releases by each process is known, a complete state transition graph can be constructed and analyzed for the presence of deadlock states and safe states.
A deadlock in a resource allocation graph can be detected by executing a 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
if at the termination of the graph reduction algorithm, all processes have been deleted.
Theorem 1: A state s is a deadlock state if and only if the resource graph of s is not completely reducible.
Theorem 2: All reduction sequences of a given resource allocation graph lead to the same final graph.
The consequence of the two theorems is that any sequence of reductions will determine whether a given resource allocation graph represents a deadlock state.
Continuous deadlock detection
Testing for deadlock can be accomplished more efficiently if done on a continuous basis. If the current state s is not deadlocked, then the next state s’ can be a deadlock state only if
the operation that caused the transition was a request for a resource and
the process p that issued the request is deadlocked in s’.
Continuous deadlock detection then proceeds as follows:
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
If p is removed then s’ is not a deadlock state and the algorithm terminates.
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.
The term “wait-for” indicates that process p is blocked on a resource currently held by another process p’.
Theorem: A cycle in the wait-for graph is a necessary and sufficient condition for deadlock.