rCore-Tutorial-Book-v3 icon indicating copy to clipboard operation
rCore-Tutorial-Book-v3 copied to clipboard

rCore-Tutorial-Book-v3/chapter8/5concurrency-problem

Open utterances-bot opened this issue 2 years ago • 4 comments

并发中的问题 - rCore-Tutorial-Book-v3 3.6.0-alpha.1 文档

https://rcore-os.cn/rCore-Tutorial-Book-v3/chapter8/5concurrency-problem.html

utterances-bot avatar Dec 12 '22 16:12 utterances-bot

第二个线程thr2设置A的值为2

第二个线程thr2设置A的值为1

操作系统有切换回线程thr1继续执行

操作系统又切换回线程thr1继续执行

安全全状态

安全全状态

Finish[0..n-1]

Finish[0..=n-1]

longguzzz avatar Dec 12 '22 16:12 longguzzz

指出了死锁产生的四个必要条件:

实际上这里应该是三个必要条件、一个充分条件,不宜混淆。

chestNutLsj avatar Oct 13 '23 09:10 chestNutLsj

实际上这里应该是三个必要条件、一个充分条件,不宜混淆。

@chestNutLsj 从ostep上面的描述来看这四个都是必要条件?

wyfcyx avatar Oct 26 '23 16:10 wyfcyx

实际上这里应该是三个必要条件、一个充分条件,不宜混淆。

@chestNutLsj 从ostep上面的描述来看这四个都是必要条件?

@wyfcyx 没有看过ostep,我根据的资料是精髓与设计原理。不过根据我的理解,互斥、占有并申请、不可抢占并不能直接导致死锁发生,但死锁一定会有这三个特征,所以是必要性;而循环等待链一旦成立,表明资源不足以供给进程的需要,因此一定会导致死锁发生,因而是充分性。

关于这个话题可以进一步查找资料和探讨。

chestNutLsj avatar Oct 26 '23 16:10 chestNutLsj