Module 3
Module 3
Deadlocks and
Memory Management
Syllabus
Deadlocks: Definition, Deadlock characteristics, Deadlock Prevention, Deadlock
Avoidance: banker’s algorithm, Deadlock detection and Recovery.
2. Assume the space is available for allocation of 200K bytes, and the following sequence of
events occurs.
P0 p1
• Hold and Wait– must guarantee that whenever a process requests a resource, it does not
hold any other resources Require process to request and be allocated all its resources
before it begins execution, or allow process to request resources only when the process
has none Low resource utilization; starvation possible.
• No Preemption : Preempt resources from the process when resources are required by
other high-priority processes.
• Circular Wait: To violate circular wait, we can assign a priority number to each of the
resource. A process can't request for a lesser priority resource. This ensures that not a
single process can request a resource which is being utilized by some other process and
no cycle will be formed.
Deadlock Detection and Recovery
• Another approach to dealing with deadlocks is to
detect and recover from them when they occur.
• This can involve killing one or more of the processes
involved in the deadlock or releasing some of the
resources they hold.
Deadlock Detection
• Deadlock detection is a process in computing where the
system checks if there are any sets of processes that are stuck
waiting for each other indefinitely, preventing them from
moving forward.
• Deadlock detection is the process of finding out whether any
process are stuck in loop or not. There are several algorithms
like
Resource Allocation Graph
Banker’s Algorithm
Resource Allocation Graph