Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How hold and wait is different from circular wait?

I am not able to figure out how two conditions for deadlock are different from each other. Hold and wait is look like a subset of the circular wait.

like image 748
lifeisshubh Avatar asked Dec 29 '16 08:12

lifeisshubh


People also ask

How can the hold and wait and circular wait condition be prevented?

– The hold andwait condition can be prevented by requiring that a process request all its required resources at one time, and blocking the process until all requests can be granted simultaneously.

What is the meaning of hold and wait?

Hold and Wait - A process must be simultaneously holding at least one resource and waiting for at least one resource that is currently being held by some other process.

What is circular wait?

Circular wait: each process must be waiting for a resource which is being held by another process, which in turn is waiting for the first process to release the resource.

What is hold and wait as used in process management?

Mutual Exclusion: Only one process can use a resource at any given time i.e. the resources are non-sharable. Hold and wait: A process is holding at least one resource at a time and is waiting to acquire other resources held by some other process.


2 Answers

Hold and Wait and Circular Wait are conditions that are met when deadlocks occur.

This means that if these two conditions are not met, you will not be in a deadlock.

The hold and wait condition states that the process is holding onto a resource/s that may (or may not) be required by other processes. The key point here is that the process is holding onto those resources and will not release them until it gets access to the requested resources (which are being held by other processes).

The circular wait condition states that there exists a chain of processes where each process is waiting for a resource that is being held by another process. In this condition it does not necessarily mean that the process is holding onto a resource that the other is requesting, but rather that all processes are waiting for a resource that is being held by another process.

See these articles for more information:

http://www.cs.yale.edu/homes/aspnes/pinewiki/Deadlock.html http://nob.cs.ucdavis.edu/classes/ecs150-1999-02/dl-cond.html

like image 137
Newteq Developer Avatar answered Oct 20 '22 10:10

Newteq Developer


For Hold And Wait, There must exist a process that is holding a resource already allocated to it while waiting for additional resource that are currently being held by other processes. Whereas, for Circular Wait to occur The processes in the system form a circular list or chain where each process in the list is waiting for a resource held by the next process in the list.

Point to be noted: the formation of chain (Circular list) is must for Circular Wait which is not the case with Hold and Wait.

Reference: http://www.personal.kent.edu/~rmuhamma/OpSystems/Myos/deadlockCondition.htm

like image 45
Anurag Singh Avatar answered Oct 20 '22 10:10

Anurag Singh