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 !

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Powered by

Up ↑

%d bloggers like this: