Process Deadlock

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 14

Process Deadlock

Nitesh Rayamajhi & Prajjwal Rana


1.What is Deadlock?

2.Conditions For Deadlock

3.Deadlock Handling

Contents 3.1Avoidance

3.2Prevention

3.3Recovery from Deadlock

3.4 Ignorance
Conclusion
What is Deadlock?
A Deadlock is a situation where each
of the computer process waits for a
resource which is being assigned to
some another process. In this situation,
none of the process gets executed
since the resource it needs, is held by
some other process which is also
waiting for some other resource to be
released.

Process Deadlock
Conditions for deadlock
1. Mutual Exclusion
2. Hold and wait
3. No preemption
4. Circular wait

Process Deadlock
1. Mutual Exclusion
A resource can only be shared in mutually exclusive manner. It
implies, if two process cannot use the same resource at the same
time.

Process Deadlock
2. Hold and Wait
A process waits for some resources while holding another
resource at the same time.

Process Deadlock
3. No preemption
The process which once scheduled will be executed till the
completion. No other process can be scheduled by the scheduler
meanwhile.

Process Deadlock
4. Circular Wait
All the processes must be waiting for the resources in a cyclic
manner so that the last process is waiting for the resource which
is being held by the first process.

Process Deadlock
Deadlock Handling

presentation title 9
Avoidance
o In deadlock avoidance, the request for any resource will be
granted if the resulting state of the system doesn't cause
deadlock in the system. The state of the system will
continuously be checked for safe and unsafe states.
o In order to avoid deadlocks, the process must tell OS, the
maximum number of resources a process can request to
complete its execution.
o The simplest and most useful approach states that the process
should declare the maximum number of resources of each type
it may ever need. The Deadlock avoidance algorithm
examines the resource allocations so that there can never be a
circular wait condition.
Process Deadlock
Prevention
1. Mutual Exclusion:
Spooling
2. No preemption:
Snatch all the resources.
3. Hold and wait:
Request for all the resources initially.
4. Circular Wait:
Assign priorities to each resources and order
each resources numerically.

Process Deadlock
Recovery from Deadlock
o Roll-back algorithm:
To recover from deadlock using this algorithm, we
backtrack to the process where the deadlock occurs and rectify
the deadlock.
o Preemption:
Using context switch to use the resource properly.
o Killing:
Kill the process that causes deadlock.

Process Deadlock
Conclusion

Process Deadlock 13
THANK YOU

Process Deadlock

You might also like