This is a multipart blog article series, and in this series I am going to explain you the concepts of operating system. This article series is divided into multiple modules and this is the forth module which consists of 8 articles.
In this article we will discuss about deadlock and ways by which deadlock occurs in detail.
Deadlock
- If two or more processes are waiting on happening of some event, which never happen then we say these processes are involved in deadlock and then it is known as deadlock.
Conditions for deadlock are
- Mutual exclusion
- No preemption
- Hold and wait
- Circular wait
Mutual exclusion: It means that the resource process using should be used in mutual exclusive way. It (resource) should not be used by more than one process at one time.
No pre-emption: No type/ chance of pre-emption would be there.
Hold and wait: Process
P1
is holdingR1
resource and waiting forR2
resource while on the other hand processP2
is holdingR2
resource and waiting forR1
resource.P1
andP2
should not release any resource, if they do this then deadlock will not happen.Circular wait: The above example is an example of circular wait, if there is circular wait, than deadlock can occur. Letβs see another example
Note: If any one condition is not fulfilled than there may be chances that deadlock do not occur.
So this was all about deadlock in an operating system. Hope you liked it and learned something new form it.
If you have any doubt, questions, quires related to this topic or just want to share something with me, then please feel free to contact me.
π± Contact Me
Twitter
LinkedIn
Telegram
Instagram
Top comments (0)