Dead Lock in operating system

Dead Lock in operating system





 

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.

In this scenario, a cycle is being formed among the three processes. None of the process is progressing and they are all waiting. The computer becomes unresponsive since all the processes got blocked.  

  • Circular Wait:-When two or More Requests are Waiting For a Long Period of Time and no one can Access the Resource  from the System Resources , Then this is called as Circular Wait For Example if two or more users Request for a Printer, at a Same Time , they Request to Print a Page. Then they will be on the Circular Wait. Means System Will Display Busy Sign of Sign.
  • Partial Allocation: –After Processing the Request, if a user doesn’t leave the Resource of the System, then we cant use the Resource of the System. Then in this Situation when the other users, Request for the Resource then the other users, will also be on the Waiting State. Then this will create the Deadlock.
  • Mutual Exclusive:-When a Single Process is used by two or more Processes, Means a Single Resource if used for performing the two or more activities as a Shared Based. But this is will Also Create a Problem because when a Second user Request for the System Resource which is being used by the user.
  • HOLD and Wait:-A Single Process may need two or more System Resources. And suppose if a Process have a Single Resource, and he is waiting the Second Resource. Then Process can’t Leave the first Resource and waiting for the Second Resource. So that there will also be the Condition of Deadlock.
  • No Preemption:-if there is no Rule to use the System Resources. Means if all the System Resources are not allocated in the Manner of Scheduling. Then this will also create a Problem for a Deadlock because there is no surety that a Process will Release the System Resources after the Completion. So Preemption and Transaction Rollback prevents Deadlock situation.

For Avoiding a Dead Lock First of all we have to detect Dead-Lock Means Firstly we have to detect why and how a Deadlock has occurred and Then Avoid or Solve the Problems those are Occurred  due to Occurrence of Deadlock.



Search within CuiTutorial

Scroll to Top