Vargas Software Development

Software is just a story about winners and glory and you know that it’s true

Deadlocks

Definition: A deadlock is a situation wherein two or more competing actions are waiting for the other to finish, and thus neither ever does. It is often seen in a paradox like ‘the chicken or the egg‘.

[Source: Wikipedia]

Cause: Deadlock occurs when a number of processes are waiting for an event which can only be caused by another waiting processes.

These are the essential requirements for a deadlock:

  1. Circular waiting. There must be a set of processes P1,P2,…Pn where P1 is waiting for a resource or signal from P2, P2 is waiting for P3 … and Pn is waiting for P1.
  2. Non-shareable resources. It is not possible to share the resources or signals which are being waited for. If the resource can be shared, there is no reason to wait.
  3. No preemption. The processes can not be forced to give up the resources they are holding.

(Possible) Solutions:

  1. Prevention. We can try to design a protocol which ensures that deadlock never occurs.
  2. Recovery. We can allow the system to enter a deadlock state and then recover.
  3. Ostrich method. We can pretend that deadlocks will never occur and live happily in our ignorance. This is the method used by most operating systems. User programs are expected to behave properly. The system does not interfere. This is understandable: it is very hard to make general rules for every situation which might arise.

[Source: A short introduction to Operating System, Mark Burgess]

And why am I writing this? Because we often blame OS developers when a deadlock situation appears.

Filed under: Opinion

Archives

About me

My name is Rafa Vargas. I'm an undergraduate student of Computer Science at University of Seville, Spain. I am mainly interested in computer security, usability and the business of software.

Click here to read the full story.

Recently on twitter