What is Deadlock and Characterization of it.?

Deadlock:


A process requests resources; and if the resources are not available at that time, the process
enters a waiting state. Sometimes, a waiting process is never again able to change state, because
the resources it has requested are held by other waiting processes. This situation is called a
deadlock.



Each process utilizes a resource in only the following sequence:

1. Request: If the request cannot be granted immediately (for example, if the resource is
being used by another process), then the requesting process must wait until it can acquire
the resource.

2. Use: The process can operate on the resource (for example, if the resource is a printer, the
process can print on the printer).

3. Release: The process releases the resource.



Deadlock Characterization:


A deadlock situation can arise if the following four conditions hold simultaneously in a system:
OR Necessary Conditions

1. Mutual exclusion: At least one resource must be held in a non-sharable mode; that is,
only one process at a time can use the resource. If another process requests that resource,
the requesting process must be delayed until the resource has been released.

2. Hold and wait: A process must be holding at least one resource and waiting to acquire
additional resources that are currently being held by other processes.

3. No preemption: Resources cannot be preempted, that is, a resource can be released only
voluntarily by the process holding it, after that process has completed its task.

4. Circular wait: A set {P0, P1,P2... ,Pn-1} of waiting processes must exist such that P0 is
waiting for a resource held by P1, P1 is waiting for a resource held by P2,Pn-1 is waiting
for a resource held by Pn and P0 is waiting for a resource held by Pn.


Comments