C191-Terms-Chapter-6 Flashcards

1
Q

reusable resource

A

A reusable resource may be requested, acquired, and later released by a process. Ex: processors, devices, memory blocks, and files.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

consumable resource

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

resource allocation graph

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

blocked

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

resource request

A

(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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

resource acquisition

A

(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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

resource release

A

(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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

deadlocked

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

deadlock state

A

A state s is called a deadlock state if s contains two or more deadlocked processes.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

safe state

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

A deadlock in a resource allocation graph can be detected by executing a graph reduction algorithm:

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

completely reducible

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Continuous deadlock detection

A

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’.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Continuous deadlock detection then proceeds as follows:

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

wait-for graph

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Recovery from a deadlock

A

can be accomplished by destroying one or more of the processes involved in the deadlock, or by removing some of the resources held by the deadlocked processes.

An alternative is to avoid the possibility of a deadlock by delaying the acquisition of resources that could cause the system to enter a deadlock state.

17
Q

maximum claim

A

of a process is the set of all resources the process may ever request. Each potential future claim of a resource is represented by a dashed edge in the resource allocation graph.

18
Q

resource claim graph

A

is an extension of the general resource allocation graph. The extended graph shows

the current allocation of resources to processes and
all current as well as all potential future requests by processes for new resources.

19
Q

The banker’s algorithm

A

emulates the strategy used by a bank when issuing loans. A loan corresponds to a resource allocation and a maximum claim corresponds to the credit limit of a customer (requesting process).

The bank grants a request as long as a sequence of loans exists that would satisfy the needs of all customers in some order. Otherwise, the granting of the request is postponed.

20
Q

The banker’s algorithm:

A

Given a resource request in a state s, temporarily grant the request by changing the request edges to allocation edges.

Execute a graph reduction on the new state s’.

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.

Theorem: If acquisition operations that do not result in a completely reducible claim graph are not executed then any system state is safe.

21
Q

Deadlock avoidance with single-unit resources

A

With single-unit resources, a process p can be blocked only if p is waiting for a resource held by another blocked process p’.

Since p’ is blocked, p’ must be waiting for another resource held by yet another process p”, etc. To make the chain irreducible in the claim graph, the processes must be blocked in a directed cycle.

22
Q

Deadlock avoidance with single-unit resources

A

The banker’s algorithm is then simplified:

Given a request for a resource in a state s, temporarily grant the request by changing the request edge to an allocation edge.

Starting with the requesting process p, determine if the graph in the temporary state s’ contains a directed cycle.

If no cycle exists then accept s’ as the new state. Otherwise, disallow the acquisition by reverting to the state s.

23
Q

Deadlock avoidance with single-unit resources. Checking for a safe state is also simplified:

A

A directed cycle can be formed only if the graph already contains an undirected cycle.

The reason is that no new edges are added to or removed from a claim graph. A claim edge can only change into a request edge, which in turn can change into an allocation edge, and eventually back to a claim edge.

Thus the initial claim graph can be analyzed for the presence of undirected cycles. If no cycle exists then all states are safe and no other checks at runtime are needed.

24
Q

Conditions for a deadlock

A

Two conditions must hold for a deadlock to occur with reusable resources:

Hold and wait: A process is already holding one resource and is requesting another resource.

Circular wait: A process must issue a resource request that closes a cycle involving at least two processes and two resources.

Deadlock is structurally impossible if either of the two conditions are eliminated.

25
Q

Eliminating hold-and-wait

A

Several alternatives to eliminating the hold-and-wait condition exist:

Every process must request all resources ever needed at the same time. The price paid for the simplicity of the approach is poor resource utilization since resources are held for unnecessarily long periods of time and thus unavailable to other processes.

Every process must release all currently held resources prior to making any new request. The approach improves resource utilization but results in repeated requests and releases of frequently used resources.

A process can be given the ability to test whether a needed resource is currently available. The process must release all currently held resources only if the requested resource is not currently available. Otherwise, the new resource may be requested and allocated immediately.

26
Q

Eliminating circular wait

A

A cycle in the resource graph can be closed only when two or more processes request the same resources but in a different order.

A circular wait is prevented if all processes are required to request all resources in the same order.

One approach is to assign a sequential ordering, seq, to all existing resources, such that seq(ri) ≠ seq(rj) for all i ≠ j. All processes are then required to request resources in only increasing sequential order.

The strict ordering rule can be relaxed if the needs of individual processes are known in advance.

In particular, any resource used by only one process cannot be part of any cycle and may be requested at any time.