Computer Science Related Others Courses AvailableThe Best Codder.blogspot.com
Posts

Conditions for Deadlock

 

Conditions for Deadlock in Operating System


Introduction to Deadlock

Every process needs some resources to complete its execution. However, the resource is granted in a sequential order.

  1. The process requests for some resource.
  2. OS grant the resource if it is available otherwise let the process waits.
  3. The process uses it and release on the completion.

A Deadlock is a situation where each of the computer process waits for a resource which is being assigned to some another process. In this situation, none of the process gets executed since the resource it needs, is held by some other process which is also waiting for some other resource to be released.

Let us assume that there are three processes P1, P2 and P3. There are three different resources R1, R2 and R3. R1 is assigned to P1, R2 is assigned to P2 and R3 is assigned to P3.

After some time, P1 demands for R1 which is being used by P2. P1 halts its execution since it can't complete without R2. P2 also demands for R3 which is being used by P3. P2 also stops its execution because it can't continue without R3. P3 also demands for R1 which is being used by P1 therefore P3 also stops its execution.

Post a Comment

© Operating System . The Best Codder All rights reserved. Distributed by