-
Deadlock Avoidance: What is the difference between deadlock avoidance and deadlock prevention?
In deadlock prevention we constrain resource requests to prevent at least one of the four conditions of deadlock. In deadlock avoidance the three necessary conditions are allowed but judicious choices are made to assure that the deadlock point is never reached.
-
Deadlock Avoidance: What are the two approaches to deadlock avoidance?
- Resource Allocation Denial
- Process Initiation Denial
-
Deadlock Avoidance: Describe the approach of Resource Allocation Denial.
do not grant an incremental resource request to a process if this allocation might lead to deadlock.
-
Deadlock Avoidance:Describe the deadlock avoidance approach of Process Initiation Denial.
Do not start a process if its demands might lead to deadlock.
-
Deadlock Avoidance: What is this?
Resources = R= (R1, R2, …, Rn)
Total amount of each resource in the system
-
Deadlock Avoidance: What is this?
Available = V= (V1, V2, …, Vn)
Total amount of each resource not allocated to any process
-
Claim = C=
Cij= requirement of process i for resource j
-
Allocation = A =
Aij = current allocation to process i of resource j
-
Deadlock Avoidance: Process Initiation Denial (defn)
- (1) Refuse to start a new process if its resource requirements might lead to deadlock
- (2) Start a new process only if:
-
Resource Allocation Denial is also referred to as:
The Bankers Algorithm
-
Resource Allocation or Bankers Algorithm:
- State of the system reflects the current allocation of resources to processes
- Safe state is one in which there is at least one sequence of resource allocations to processes that does not result in a deadlock
- Unsafe state is a state that is not safe Analogy = banker refusing to grant a loan if funds are too low to grant more loans + uncertainty about how long a customer will take to repay
-
Deadlock Detection: The four steps of:
- Step 1: Mark each process that has a row in the Allocation matrix of all 0s
- Step 2: Initialize temporary vector W to be equal to the Available vector
- Step 3: Find index i such that process i is currently unmarked and the i throw of Q is less than or equal to W. If no such row is found, then terminate.
- Step 4: For each row found in step 3, mark process i and add the corresponding row of the allocation matrix to W.
At the end, unmarked processes are deadlocked
-
Deadlock Recovery: Three strategies of:
- 1 - Abort all deadlocked processes
- 2 - Back up each deadlocked process to some previously defined checkpoint and restart all processes
- 3 -Successively abort deadlocked processes until deadlock no longer exists
-
Deadlock Recovery: Successively abort... means?
means an order is followed:
- (1)Least amount of CPU time consumed,
- (2) Lowest priority,
- (3) Least total resources allocated so far, etc.
-
Table Summary of Deadlock Detection, Prevention and Avoidance.
|
|