Strategies for dealing deadlock handling:
- Deadlock ignorance: In this, operating system assumes that deadlock never occurs, means it ignores the deadlock.
- Deadlock prevention: Deadlock happens only when Mutual Exclusion, hold and wait, No preemption and circular wait holds simultaneously. If it is possible to violate one of the four conditions at any time then the deadlock can never occur in the system.
- Deadlock avoidance: In this, OS checks whether system is in safe state or it is in unsafe state at every step which the operating system performs. And this process gets repeat till the system comes in safe state. Once the system moves to unsafe state, the OS has to backtrack one step. The OS reviews each allocation so that the allocation doesn't cause the deadlock in the system.
- Deadlock detection and recovery: If the process falls in deadlock then periodically check whether deadlock occurs in the system or not. If deadlock occurs then then it applies some of the recovery methods to the system to get rid of deadlock.
The required four necessary condition for the deadlock is given below:
Mutual exclusion: A resource can hold only one process at time.
- Hold and wait: A resource can hold any number of process at a time and at the same time it can request other resources also, which are being hold by some other process.
- No preemption: A resource can't be preempted from the process by another process, forcefully
- circular wait: Circular wait is a condition when the first process is waiting for the resource held by the second process, the second process is waiting for the resource held by the third process, and so on. At last, the last process is waiting for the resource held by the first process.
Comments
Leave a comment