Professional Documents
Culture Documents
11 - 15 - Lec 15 Deadlock
11 - 15 - Lec 15 Deadlock
SYSTEM: CSET209
OUTLINE
Deadlock
Resource Allocation graphs
RESOURCES
3
RESOURCES
Deadlocks occur when …
processes are granted exclusive access to devices
we refer to these devices generally as resources
Preemptable resources
can be taken away from a process with no ill effects
Non-preemptable resources
will cause the process to fail if taken away
4
RESOURCES
5
DEADLOCK EXAMPLE
A set of blocked processes each holding a resource and waiting to acquire a resource held by another
process in the set
Example
❖ Implication for Deadlock: If all processes have exclusive access to a resource, and a process
is holding a resource while waiting for another, it can lead to a deadlock situation. This is
because the process holding the resource may prevent other processes from proceeding.
2. Hold and Wait
❖ Definition: A process must be holding at least one resource and waiting to acquire additional
resources held by other processes.
❖ Implication for Deadlock: If a process acquires a resource and then waits for another
resource, it holds resources while potentially blocking other processes from acquiring the
resources they need. This holding and waiting pattern can lead to a deadlock when multiple
processes are waiting for resources held by each other.
❖ Prevention: - Design protocols in a way that eliminates the possibility of deadlock.
❖ Avoidance: - Make efforts to prevent deadlock during runtime, ensuring that the system never
❖ Detection: - Allow the system to potentially enter a deadlocked state and then detect it.
❖ Ignorance: - Disregarding the problem altogether and pretending that deadlocks do not occur in the
system.
A directed graph used to model resource
requests and allocations.
• NO
RESOURCE-ALLOCATION GRAPH EXAMPLE
❖ YES
RESOURCE-ALLOCATION GRAPH EXAMPLE
(deadlock)
DEADLOCK IS A PROBABILISTIC EVENT
❑ Suppose there are 3 processes A, B, and C requesting resources R, S, and T as follows.
A B C
Request R Request S Request T
Request S Request T Request R
Release R Release S Release T
Release S Release T Release R
NO deadlock)