Tuesday 17 July 2012

Deadlock


In a multiprogramming environment, several processes may compete for a finite number of resources. Generally a process may utilize the resource in the following fashion –

ð  Request for a resource
ð  Use the resource
ð  Release the resource

But in an Operating System sometimes a situation might occur when a process enters a waiting state because a resource requested by it is being held by another process, which in turn is waiting for another resource. The above situation is known as Deadlock.

Note - If a process is unable to change its state indefinitely because the resources requested by it are being used by other waiting process, then the system is said to be in a deadlock.

Question – What can be a resource?
Answer – A resource can be anything that can only be used by a process at any instant of time.

Deadlock is a common problem in –  Multiprocessing systems,  Parallel computing,  Distributed systems

Necessary conditions for Deadlock – A deadlock situation might arise if the following conditions are held simultaneously in the system –
  1. Mutual Exclusion
  2. Hold and Wait
  3. No - Preemption
  4. Circular Wait

No comments:

Post a Comment