Prerequisite – Deadlock Detection And Recovery
When a Deadlock Detection Algorithm determines that a deadlock has occurred in the system, the system must recover from that deadlock. There are two approaches of breaking a Deadlock:
1. Process Termination:
To eliminate the deadlock, we can simply kill one or more processes. For this, we use two methods:
- (a). Abort all the Deadlocked Processes:
Aborting all the processes will certainly break the deadlock, but with a great expenses. The deadlocked processes may have computed for a long time and the result of those partial computations must be discarded and there is a probability to recalculate them later.
- (b). Abort one process at a time untill deadlock is eliminated:
Abort one deadlocked process at a time, untill deadlock cycle is eliminated from the system. Due to this method, there may be considerable overhead, because after aborting each process, we have to run deadlock detection algorithm to check whether any processes are still deadlocked.
2. Resource Preemption:
To eliminate deadlocks using resource preemption, we preepmt some resources from processes and give those resources to other processes. This method will raise three issues –
- (a). Selecting a victim:
We must determine which resources and which processes are to be preempted and also the order to minimize the cost.
- (b). Rollback:
We must determine what should be done with the process from which resources are preempted. One simple idea is total rollback. That means abort the process and restart it.
- (c). Starvation:
In a system, it may happen that same process is always picked as a victim. As a result, that process will never complete its designated task. This situation is called Starvation and must be avoided. One solution is that a process must be picked as a victim only a finite number of times.
Attention reader! Don’t stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the CS Theory Course at a student-friendly price and become industry ready.
- Deadlock Detection And Recovery
- Difference between Deadlock Prevention and Deadlock Avoidance
- Introduction of Deadlock in Operating System
- Program for Deadlock free condition in Operating System
- Conditions for Deadlock in Operating System
- Deadlock Ignorance in Operating System
- Deadlock Detection Algorithm in Operating System
- Hierarchical Deadlock Detection in Distributed System
- Database Recovery Techniques in DBMS
- Log based Recovery in DBMS
- Error detection and Recovery in Compiler
- System Protection in Operating System
- User View Vs Hardware View Vs System View of Operating System
- System Programs in Operating System
- File System Implementation in Operating System
- Xv6 Operating System -adding a new system call
- Traps and System Calls in Operating System (OS)
- Deadlock Prevention And Avoidance
- Deadlock in DBMS
- Introduction to TimeStamp and Deadlock Prevention Schemes in DBMS
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.