Deadlocks and Deadlock Prevention
In order for a deadlock to occur, you must have all four of the following conditions met:
- Mutual Exclusion:Only one process can access a resource at a given time.(Or, more accurately, there is limited access to a resource. A deadlock could also occur if a resource has limited quantity.)
- Hold and Wait: Processes already holding a resource can request additional resources, without relinquishing their current resources.
- No Preemption: One process cannot forcibly remove another process’ resource.
- Circular Wait: Two or more processes form a circular chain where each process is waiting on another resource in the chain.
Deadlock prevention entails removing any of the above conditions.
大部分方法都专注在解决第四点。
评论