7-Deadlocks, Resource-Allocation Graph, Methods For Handling Deadlocks-13!08!2024
7-Deadlocks, Resource-Allocation Graph, Methods For Handling Deadlocks-13!08!2024
Module 3
Module 3
Deadlock
Deadlock – Conditions
The deadlock system model includes the four necessary conditions for deadlock
to occur:
§ Mutual Exclusion: Resources can only be used by one process at a time.
§ Hold and Wait: Processes hold allocated resources while waiting for additional
resources.
§ No Preemption: Resources cannot be forcibly taken away from a process.
§ Circular Wait: There exists a circular chain of processes, with each process
holding a resource that is requested by the next process in the chain.
Module 3
Deadlock – Conditions
§ By analyzing the resource allocation graph and checking for
the presence of a circular chain of processes, it is possible to
identify the occurrence of a deadlock in the system.
§ Mutual Exclusion
No Preemption:
Deadlock – Management
§ When the conditions (discussed in last 4 slides) are satisfied, a deadlock can occur.
As a result, none of the processes involved can make progress, leading to a system
deadlock.
§ The goal is to ensure that the system remains in a safe state where deadlocks cannot
occur, or if they do occur, they can be resolved efficiently to restore system
functionality.
Module 3
§ It is a proactive approach.
Claim Edge
Allocation R1
Edge
P1 P2
Reqquest
Edge R2
Module 3
R1 R1
P1 P2 P1 P2
R2 R2
Module 3
There exists a safe sequence P2, P0, P1, P3 in which all the processes
can be executed. So, the system is in a safe state.
Deadlock Avoidance
§ RAG Scheme – when single Instance of Resource exists.
§ Bankers Algorithm - when multiple Instance of Resource exists.
Deadlock Detection
§ Wait for graph. - single Instance of Resource exists
§ Detection algorithm using Available, Allocated, Requested, Need - multiple Instance of Resource exists
Deadlock Recovery
§ Process Termination.
§ Resource Preemption.