操作系统 ppt6.ppt
《操作系统 ppt6.ppt》由会员分享,可在线阅读,更多相关《操作系统 ppt6.ppt(52页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、Concurrency:Deadlock(死锁)and Starvation(饥饿)Chapter 616.1 Principles of Deadlock6.1 Principles of Deadlock6.2 Deadlock Prevention6.3 Deadlock Avoidance6.4 Deadlock Detection 6.5 An Integrated Deadlock Strategy6.6 Dining Philosophers Problem6.7 Summary2DeadlockPermanent blocking of a set of processes t
2、hat either compete for system resources or communicate with each otherNo efficient solutionInvolve conflicting(冲突)needs for resources by two or more processes3456Resources Categories(资源的分类)Reusable Resources(可重用资源)Consumable Resources(可消费资源)76.1 Principles of Deadlock6.1.1 Reusable Resources6.1.2 Co
3、nsumable Resources6.1.3 Resource Allocation Graphs6.1.4 The Conditions for Deadlock8Reusable Resources(可重用资源)Used by only one process at a time and not depleted(耗尽)by that useProcesses obtain resources that they later release for reuse by other processesProcessors,I/O channels,main and secondary mem
4、ory,devices,and data structures such as files,databases,and semaphoresDeadlock occurs if each process holds one resource and requests the other9Example of DeadlockInterleaves the execution:p0 p1 q0 q1 p2 q210Another Example of DeadlockSpace is available for allocation of 200Kbytes,and the following
5、sequence of events occurDeadlock occurs if both processes progress to their second requestP1.Request 80 Kbytes;Request 60 Kbytes;P2.Request 70 Kbytes;Request 80 Kbytes;116.1 Principles of Deadlock6.1.1 Reusable Resources6.1.2 Consumable Resources6.1.3 Resource Allocation Graphs6.1.4 The Conditions f
6、or Deadlock12Consumable Resources(可消费资源)Created(produced)and destroyed(consumed)Interrupts,signals,messages,and information in I/O buffersDeadlock may occur if a receive message is blockingMay take a rare combination of events to cause deadlock(很少的事件组合也可能导致死锁)13Example of DeadlockDeadlock occurs if
7、receive is blockingP1.Receive(P2);Send(P2,M1);P2.Receive(P1);Send(P1,M2);146.1 Principles of Deadlock6.1.1 Reusable Resources6.1.2 Consumable Resources6.1.3 Resource Allocation Graphs6.1.4 The Conditions for Deadlock15Resource Allocation Graphs(资源分配图)Directed graph(有向图)that depicts(表述)a state of the
8、 system of resources and processes16Resource Allocation Graphs176.1 Principles of Deadlock6.1.1 Reusable Resources6.1.2 Consumable Resources6.1.3 Resource Allocation Graphs6.1.4 The Conditions for Deadlock18Conditions for Deadlock(死锁的条件)Mutual exclusion(互斥)Only one process may use a resource at a ti
9、meHold-and-wait(占有且等待)A process may hold allocated resources while awaiting assignment of othersNo preemption(非抢占)No resource can be forcibly removed form a process holding it19Conditions for DeadlockCircular wait(循环等待)A closed chain of processes exists,such that each process holds at least one reso
10、urce needed by the next process in the chain20Possibility of DeadlockMutual ExclusionHold and wait No preemption21Existence of DeadlockMutual ExclusionHold and waitNo preemptionCircular wait22Agenda6.1 Principles of Deadlock6.2 Deadlock Prevention6.3 Deadlock Avoidance6.4 Deadlock Detection 6.5 An I
11、ntegrated Deadlock Strategy6.6 Dining Philosophers Problem6.7 Summary23Deadlock Prevention(死锁预防)Mutual ExclusionMust be supported by the operating systemHold and WaitRequire a process request all of its required resources at one time24Deadlock PreventionNo PreemptionProcess must release resource and
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 操作系统 ppt6
限制150内