Friday, January 27, 2017

Necessary conditions for deadlocks in computing

Earlier I have described about deadlock in computing. In this article, I am going to discuss about  the necessary conditions, those hold simultaneously in a system to arise deadlock situation.

We can discuss these necessary conditions more precisely in terms of a directed graph called a system resource-allocation graph. So I used related  diagrams with description.
In this diagrams rounded rectangles visualize a resource and dots inside it visualize number of instances of the resource.Circles visualize processes.


Mutual Exclusion

In this scenario, there is a one resource(R1) with non-shareable mode. That means only one process can be used at a time. If another process requests that resource(P1), the requesting process(P1) must be wait until the resource has been released by first process(P2). 




Hold and wait

When a process(P2) holding one resource(R1) and applying for another resource(R2) which is already acquired.


No preemption

Resources cannot be preempted. That means a resource can be released voluntarily by the process  that holding it or after that process has completed its task. P1 has to be wait until R1 is free by P2.




Circular wait

A set of waiting processes {P1, P2,  P3}  must exist such that P1 is waiting for a resource held by P2, P2 is waiting for a resource held by P3. Likewise P3 is waiting for a resource held by P1 and P2. 





All four conditions must hold for a deadlock to occur. The circular-wait condition implies the hold-and-wait condition, so these four conditions are not completely independent. 



If you like this post, spread by sharing it on social media. Thank you ! 

No comments:

Post a Comment

How to send Slack notification using a Python script?

 In this article,  I am focussing on sending Slack notifications periodically based on the records in the database. Suppose we have to monit...