操作系统学习之关于死锁的理解
参考书目操作系统——精髓与设计原理(第七版) William Stallings(威廉.斯托林斯)
感觉这本书图文丰富,比那边现代操作系统好读一些
操作系统——精髓与设计原理,这是我见到关于死锁讲解的最为深刻,最容易理解的操作系统的书了。
按照数学中充分条件和必要条件讲解的,甚为亲切啊
原书第六章:
Conditions for Deadlock
• Mutual exclusion(互斥—排它性访问资源)
– only one process may use a resource at a time
• Hold-and-wait(占有且等待—拥有部分资源,还要请求新的)
– A process does not request all of its required resources at one time
• No preemption(非剥夺性—排他性访问资源)
– If a process holding certain resources is denied a further request, that process must not release its original resources
– If a process requests a resource that is currently held by another process, the operating system is not allowed to preempt the second process and require it to release its resources
• Circular wait(循环等待—在进程资源图中有环路)
**若可能发生死锁,则必定要出现三个条件:
1.互斥。一次只有一个进程可以使用一个资源。其他进程不能访问已分配给其他进程的 资源。
2.占有且等待。当一个进程在等待分配得到其他资源时,其继续占有已分配得到的资源。
3.非抢占。不能强行抢占进程中已占有的资源。
4.循环等待。存在一个封闭的进程链,使得每个资源至少占有此链中下一个进程所需要的一个资源.**
死锁的必要条件
Possibility of Deadlock
• Mutual Exclusion
• No preemption
• Hold and wait
以上的三个条件都是死锁存在的必要条件,但不是充分条件
Circular wait(死锁的充分必要条件),第四个条件实际上是前三个条件的潜在结果。
Existence of Deadlock
• Mutual Exclusion
• No preemption
• Hold and wait
• Circular wait(死锁的充分必要条件)