h*********3 发帖数: 111 | 1 deadlock 可以避免吗?
如果不行,说明原因。
如果可以,如何避免? |
M7 发帖数: 219 | 2 看一下wiki吧。
【在 h*********3 的大作中提到】 : deadlock 可以避免吗? : 如果不行,说明原因。 : 如果可以,如何避免?
|
c**y 发帖数: 172 | 3 From operating system perspective, four conditions are necessary for
deadlock. Note that none of them is sufficient.
1. finite resources
2. circular wait
3. wait and hold
4. non preemptive
Deadlock can be avoided. Among the four conditions mentioned above, only
condition 2 can be regulated to avoid deadlock. In general the solution is
to put order in multiple locks, and a thread must acquire all necessary
locks in the same order. This way is usually called "canonical lock". |
j********x 发帖数: 2330 | 4 deadlock avoidance and prevention is possible.
But may cause live lock if I remember right. |