CHAPTER6Concurrency:deadlockAnd Starvation内容提要·产生死锁与饿死的原因·解决死锁的方法·死锁/同步的经典问题:哲学家进餐问题
CHAPTER 6 Concurrency:deadlock And Starvation 内容提要 •产生死锁与饿死的原因 •解决死锁的方法 •死锁/同步的经典问题:哲学家进餐问题
6.1PrinciplesofDeadlock·死锁的定义:Permanent blocking of a set of processes thateither compete for system resources orcommunicatewitheachother(一组竞争系统资源或互相通信的进程间相互的“永久”阻塞。)No efficient solution. Involve conflicting needs for resources by twoormoreprocesses(所有死锁涉及到两个或更多的进程之间因对资源的需求所引起的冲突
6.1 Principles of Deadlock • 死锁的定义: Permanent blocking of a set of processes that either compete for system resources or communicate with each other(一组竞争系统资 源或互相通信的进程间相互的“永久”阻塞。 ) • No efficient solution • Involve conflicting needs for resources by two or more processes(所有死锁涉及到两个或更 多的进程之间因对资源的需求所引起的冲突。 )
39(b)Deadlock(a)DeadlockposslbleFigure 6.1 Ilustration of Deadlock
,现在考虑涉及进程和计算机资源的死锁的描述。例, Process P and Q compete tworesources, Their general forms are:Process PProcess QGet AGet BGet BGet AReleaseARelease BRelease BRelease A
• 现在考虑涉及进程和计算机资源的死锁 的描述。 例, Process P and Q compete two resources, Their general forms are: Process P Process Q . . Get A Get B . . Get B Get A . . Release A Release B . . Release B Release A .
ProgressofoReleaseAReleaseRequiredBGetA3deadlockBandinevitableRRequlred5GetB14-.6ProgressofpGet BGetAReleaseAReleaseBARequiredBRequlredFigure 6.2Exampleof Deadllock[BACO98]