死锁 - 两个或多个相互竞争的 Action 都在等待对方完成的情况,因此两者都没有。
无限期推迟 - 无限期延迟一个进程的调度,而其他进程受到系统的关注
这两个术语看起来非常相似。我如何区分它们?
最佳答案
In any system that keeps processes waiting while it makes resource-allocation and process scheduling decisions, it is possible to delay indefinitely the scheduling of a process while other processes receive the system's attention. This situation, variously called indefinite postponement, indefinite blocking, or starvation, can be as devastating as deadlock
从:
http://wps.prenhall.com/esm_deitel_os_3/17/4402/1127072.cw/index.html
哈文德的死锁条件(1968) - 7.2.1
• There is a circular list of processes each wanting a resource owned by another in the list.
• Resources cannot be shared.
• Only the owner can release the resource
• A process can hold a resource while requesting another
从:
http://www.cs.auckland.ac.nz/~robert-s/415.340/lectures_1997/lecture35.pdf
所以无限延迟导致1个进程受到影响而其他进程正常继续,这可能是由于调度不佳或其他原因造成的,即无限延迟的进程始终比同一资源后的所有其他进程具有更低的优先级。在稍后的某个时间,它可能最终获得足够高的优先级来获取资源。
当一个进程请求另一个进程持有的资源时会导致死锁。那个进程 (A) 不会释放资源,直到它得到它正在请求的另一个资源,顺便说一句,另一个进程 (B) 不会释放它,直到它收到另一个进程 (C) 持有的资源不会释放它,直到它得到 (A) 持有的资源。该场景涉及 3 个流程,A、B、C;但它可能涉及 2 个或更多进程的任何“循环”。
关于concurrency - 死锁和无限期推迟有什么区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19482820/