gpt4 book ai didi

unix - 内核 : Dealing with deadlocks in unix

转载 作者:行者123 更新时间:2023-12-01 22:29:15 26 4
gpt4 key购买 nike

A deadlock would occur if process 1 locks resource A and waits for resource B, while simultaneously (due to context switches at the "right" places) process 2 locks resource B and waits for access to resource A.

Unix 如何处理此类死锁?我读了以下内容here

Many deadlocks can be prevented by simply requiring all processes that lock multiple resources to lock them in the same order (e.g., alphabetically by lock name)

如何更改获取锁的顺序而不更改执行顺序?有人可以详细说明现代 Unix 内核所采用的死锁处理方法吗?

最佳答案

对于 Linux 内核,它不处理这个问题,因为它不知道如何修复它。相反,它会在运行时检测到这种死锁并进行提示。

它使用的技术是lockdep,这是一个运行时锁定正确性验证器,详细信息请查看内核文档Documentation/lockdep-design.txt .

关于unix - 内核 : Dealing with deadlocks in unix,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13658645/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com