Saturday, 18 August 2012

Deadlock

                              DEADLOCK
A deadlock is a situation which occurs when a process enters a waiting state because a resource requested by it is being held by another waiting process, which in turn is waiting for another resource. In this case all process are in wait queue for some even to happen.
 An example in our practical life



now suppose  there are two process A and B. process A is currently holding printer and process B is currently holding a file on tape drive. Later on process B requests for printer releasing the tape drive and process A request for the tape drive without releasing the printer. This is dedlock .

   
For a deadlock situation the following four condition should arrise at the same time  
                                                  1) Mutual exclution
                                                  2)Hold and Wait
                                                  3) No Preemption
                                                  4) Circular Wait

  1. Mutual Exclusion: At least one resource must be non-share able. Only one process can use the resource at any given instant of time.
  2. Hold and Wait: A process is currently holding at least one resource and requesting additional resources which are being held by other processes.
  3. No Preemption: The operating system must not de-allocate resources once they have been allocated; they must be released by the holding process voluntarily.
  4. Circular Wait: A 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.

     Methods for handling deadlock :
                                      1) to ignore a deadlock
                                      2)detect a deadlock
                                      3)recover from deadlock
                                      4)prevent and avoid a deadlock




           .                                                                     ........... to be continued                               R.P

No comments:

Post a Comment