Deadlock – Characteristics of Deadlock

By | September 24, 2021

Characteristics of Deadlock in OS


A deadlock is a situation in which two processes sharing the same set of resources are effectively preventing each other from accessing the resource, resulting in both programs ceasing to function. Deadlocks situation occurs when two or more processes attempt to access a resource, which is locked by another process and therefore, cannot be shared. Due to this locking of resource, each process has to wait for resource locked by another process and as a result none of the transaction can finish.

Thus, in deadlock, processes never finish executing and system resources are tied up, preventing other jobs from starting.

A deadlock defined formally as :

“A set of processes is deadlocked if each process in a set is waiting for an event that only another process in the set can cause”.

Consider a system with one printer and one tape drive.

Suppose process Pi, is holding the tape drive and process Pj is holding the printer as shown in figure.

A simple deadlock involving two resources, Characteristics of Deadlock

A simple deadlock involving two resources

At any moment of time, process Pi needs printer and process Pj needs tape drive. Thus, now Pi requests printer and is holding tape drive. Process Pj requests tape drive and is holding printer.

Now both the process Pi and Pj deadlocked. The system deadlocked because each process holds a resource requested by other process and neither process willing to release the resource it holds.

Four conditions necessary for deadlock

The four necessary characteristics for deadlock in OS are :

  1. Mutual Exclusion
  2. Hold and Wait
  3. No preemption
  4. Circular Wait

1. Mutual Exclusion :

Mutual exclusion means that a resource can used by only one process at a time. For example, if a process P1 locks the resource R in exclusive mode, no other process can acquire this resource R. If another process requests, this resource, the requesting process must be delayed until the resource has been Ans. released.

2. Hold and Wait :

The processes involved in deadlock acquires at least one resource and wait for at least another resource that has been acquired by another process.

3. No preemption :

Resources held by a process cannot preempted. A resource can released only voluntarily by the process holding it, after that process has completed its task.

4. Circular Wait :

A circular chain or a circular relationship exists among the processes involved in a deadlock. In such a chain each process waits for a resource held by the next process in the chain. For example, there are three processes, P1, P2 and P3.

The process P1 waiting for a resource held by the process P2, P2 is waiting for a resource; held by P3 and P3 waiting for a resource held by the process P1.

Related posts:-

[su_posts template=”templates/list-loop.php” posts_per_page=”3″ taxonomy=”link_category” tax_operator=”NOT IN” order=”

One thought on “Deadlock – Characteristics of Deadlock

  1. Glen

    It’s impressive that you are getting thoughts from this post as well as from our discussion made at this time.

Comments are closed.