Deadlock | Operating System - M04 P01

Subscribe to my newsletter and never miss my upcoming articles

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.

Untitled Diagram.png

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 holding R1 resource and waiting for R2 resource while on the other hand process P2 is holding R2 resource and waiting for R1 resource. P1 and P2 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

Untitled Diagram (1).png 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,

📧 Write a mail

rahulmishra102000@gmail.com

GitHub, HackerRank

No Comments Yet