4
4
CHAPTER-1
Deadlocks
Deadlock Definition
Deadlock:
•In a multiprogramming system, several process compete for limited
number of resources and if resource is not available at that
instance then process enters waiting state
•If a process is unable to change its waiting state indefinitely
because the resources requested by it are held by another waiting
process, then system is said to be in deadlock.
•OR
•If a two or more process are waiting on happening some event,
which never happed then we say these process core involved
deadlock then that state is called deadlock.
Example: Bridge Crossing
guarantee one
Example
Fig: Resource allocation graph with a deadlock Fig: Resource allocation graph with a cycle but no deadlock
Deadlock handling methods
• Prevention: it means to design such a system which violate
atleast one of the four necessary condition of deadlock and
ensure that deadlock should not occur.
• Avoidance: System maintains a set of data using which it takes a
decision whether to entertain a new request or not, to be in safe
state.
• Detection & recovery: In this we wait untill the deadlock occurs
and once we detect it, we recover from it.
• Ignorance: We ignore the problem as if it does not exist.
Deadlock Prevention
Mutual Exclusion:
• If a resource is assigned to more than one process, i.e., if a
resource is made sharable then deadlock will not occur
Windows 10
Deadlock Recovery
• When a Deadlock Detection Algorithm determines that a
deadlock has occurred in the system, the system must recover
from that deadlock.
• There are two approaches of breaking a Deadlock:
1. Process Termination
2. Resource Pre-emption
Deadlock Recovery
1. Killing Process :
killing all process involved in deadlock.
Killing process one by one after killing each process check for
deadlock again.
2. Resource Pre-emption:
Resources are pre-empted from the process involved in
deadlock, pre-empted resources are allocated to other process so
that there is the probability of recovering the system from
deadlock.
References
[1] Silberschatz, A., Galvin, P. B., & Gagne, G. (2005). Operating system concepts.
Hoboken, NJ: J. Wiley & Sons.
[2] Stallings, W. (2018). Operating systems: Internals and design principles.
Prentice-Hall
[3] Tanenbaum, A. (2014). Modern operating systems. Harlow: Pearson.
[4] Nutt, G. J. (2004). Operating systems: A modern perspective. Boston:
Pearson/Addison Wesley.
[5] Bower T. Operating System Structure. K–State Polytechnic.
http://faculty.salina.k-state.edu/tim/ossg/Introduction/struct.html
[6] Bower T. Basic Operating System Concepts. K–State Polytechnic.
http://faculty.salina.k-state.edu/tim/ossg/Introduction/OSrole.html
www.paruluniversity.ac.in