12.29
no deadlock
initial: a = 1, b = 1, c = 1
thread 1 | thread 2 |
---|---|
P(a) | P(c) |
P(b) | P(b) |
V(b) | V(b) |
P(c) | V(c) |
V(c) | —— |
V(a) | —— |
thread 2 doesn’t manipulate mutex a and initial a is 1, so P(a), V(a) don’t affect deadlock status.
thread 1 | thread 2 |
---|---|
P(b) | P(c) |
V(b) | P(b) |
P(c) | V(b) |
V(c) | V(c) |
+
|
|
+ +----------+
V(c)| | |
| | |
+ | |
| | |
| | |
+ +----------+ | |
V(b)| | | | |
| | | | |
+ | | | |
| | | | |
| | | | |
+ +----------+ | |
P(b)| | |
| | |
+ | |
| | |
| | |
+ +----------+
P(c)|
|
+
|
|
+----+----+----+----+----+----+----+----+----+ thread 1
P(b) V(b) P(c) V(c)
当前内容版权归 DreamAndDead 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 DreamAndDead .