Ignorance – If deadlocks are not liable to happen, the effort required to deal with them outweighs the problem of deadlocks actually occurring.
Detection and Recovery – Keep log of resource ownership and requests. If no progress is made, recover from said deadlock by pre-emption (steal a resource from another process), rollback (make checkpoints – but operating systems aren't Halo or Call of Duty, this is difficult), or crudely killing processes in the deadlock cycle.
Deadlock Avoidance – The most difficult option. We disallow deadlock by setting “safe states”, in which process completion is always guaranteed.
Deadlock Prevention – Negate one of the four deadlock conditions. Most commonly we deal with the circular wait condition. Attacking mutex is infeasible, attacking hold and wait is prone to starvation, and attacking no preemption is downright idiotic.
- asked 5 years ago
- B Butts