Deadlocks:: Group 3 Gabriel Zialcita Ralph Regan Choa Elmer Soria Marc Doroja Nikko Reyes Enrique Malonzo
Deadlocks:: Group 3 Gabriel Zialcita Ralph Regan Choa Elmer Soria Marc Doroja Nikko Reyes Enrique Malonzo
Group 3:
Gabriel Zialcita
Ralph Regan Choa
Elmer Soria
Marc Doroja
Nikko Reyes
Enrique Malonzo
Table of Contents
System Model
Conditions
Resource-Allocation Graph
Deadlock Prevention
Deadlock Avoidance
Deadlock Detection
What is Deadlocks?
•The event where several processes may compete for a finite number
of resources
•It may happen that waiting processes will never again change state,
because the resources they have requested are held by other waiting processes
System Model
Conditions
Resource-Allocation Graph
Deadlock Prevention
Deadlock Avoidance
Deadlock Detection
System Model
rce before using it, and must release the resource after using it.
est cannot be granted immediately, then the requesting process must wait until it
resources
is free or allocated, and, for each resource that is allocated, to which process
tate when every process in the set is waiting for an event that can be caused by
System Model
ing a tape drive, if each process now requests for a new tape drive , the 3 proces
ta type that provides a simple but useful abstraction for controlling access by multiple processes to a
Table of Contents
System Model
Conditions
Resource-Allocation Graph
Deadlock Prevention
Deadlock Avoidance
Deadlock Detection
Conditions
for a resource that is held by P1, P1 is waiting for a resource that is held by P
Table of Contents
System Model
Conditions
Resource-Allocation Graph
Deadlock Prevention
Deadlock Avoidance
Deadlock Detection
Resource-Allocation Graph
Process
Pi Pi requests instance of Rj
Rj
Pi Pi is holding an instance of Rj
Rj
Resource-Allocation Graph
Resource-Allocation Graph
Resource-Allocation Graph
Resource-Allocation Graph
Resource-Allocation Graph
Resource-Allocation Graph
Resource-Allocation Graph
Resource-Allocation Graph
Resource-Allocation Graph
Resource-Allocation Graph
Resource-Allocation Graph
Resource-Allocation Graph
Table of Contents
System Model
Conditions
Resource-Allocation Graph
Deadlock Prevention
Deadlock Avoidance
Deadlock Detection
Deadlock Prevention
immediately, then all currently-held processes are preempted (i.e. removed). They a
numeration. The strict ordering will mean that no cycles will be present.
Table of Contents
System Model
Conditions
Resource-Allocation Graph
Deadlock Prevention
Deadlock Avoidance
Deadlock Detection
Deadlock Avoidance
l model requires that each process declare the maximum number of resources of eac
te is defined by the number of available and allocated resources, and the maximum
Safe State
System Model
Conditions
Resource-Allocation Graph
Deadlock Prevention
Deadlock Avoidance
Deadlock Detection
Deadlock Detection
work [] = available []
= 1 , 2 ,... n , if allocation [ i ] != 0 then
finish [ i ] = false ; otherwise , finish [ i ] = true ;
such that :
== false and request [ i ] <= work
h i exists , go to step 4 .
work + allocation [ i ]
= true
ep 2
i] == false for some i , then the system is in deadlock
[i] == false , then process p [ i ] is deadlocked .
Example
Deadlock Detection
Banker’s Algorithm
Deadlocks Recovery
Banker’s Algorithm
Need
A B C
P0 7 4 3
P1 1 2 2
P2 6 0 0
P3 0 1 1
P4 4 3 1
a safe state since the sequence < P1, P3, P4, P2, P0> satisfies
Example: P1 Request (1,0,2)
Deadlock Detection
Banker’s Algorithm
Deadlocks Recovery
Recovery from Deadlock: Process Termination
– minimize cost.
o some safe state, restart process for that state.
process may always be picked as victim, include number of roll