操作系统精髓与设计原理英文

上传人:宝路 文档编号:48331601 上传时间:2018-07-13 格式:PPT 页数:53 大小:1.22MB
返回 下载 相关 举报
操作系统精髓与设计原理英文_第1页
第1页 / 共53页
操作系统精髓与设计原理英文_第2页
第2页 / 共53页
操作系统精髓与设计原理英文_第3页
第3页 / 共53页
操作系统精髓与设计原理英文_第4页
第4页 / 共53页
操作系统精髓与设计原理英文_第5页
第5页 / 共53页
点击查看更多>>
资源描述

《操作系统精髓与设计原理英文》由会员分享,可在线阅读,更多相关《操作系统精髓与设计原理英文(53页珍藏版)》请在金锄头文库上搜索。

1、Concurrency: Deadlock and StarvationChapter 61Deadlock Each process in a process group is waiting for some resource occupied by another process of the same group, so that every process of the group is in starvation Permanent blocking of a set of processes that either compete for system resources or

2、communicate with each other No efficient solution Involve conflicting needs for resources by two or more processes2P1P2P3P43Process P Process Q Get AGet B Get BGet A Release A Release B Release B Release A 4Process P Process Q Get AGet B Release A Get A Get B Release B Release B Release A 5Reusable

3、Resources Used by only one process at a time and not depleted by that use Processes obtain resources that they later release for reuse by other processes Processors, I/O channels, main and secondary memory, devices, and data structures such as files, databases, and semaphores Deadlock occurs if each

4、 process holds one resource and requests the other6Example of DeadlockDeadlock would be happened if Executing sequence isp0 p1 q0 q1 p2 q27Another Example of Deadlock Space is available for allocation of 200Kbytes, and the following sequence of events occur Deadlock occurs if both processes progress

5、 to their second requestP1 . . . . .Request 80 Kbytes;Request 60 Kbytes;P2 . . . . .Request 70 Kbytes;Request 80 Kbytes;8Consumable Resources Created (produced) and destroyed (consumed) Interrupts, signals, messages, and information in I/O buffers Deadlock may occur if a Receive message is blocking

6、May take a rare combination of events to cause deadlock9Example of Deadlock Deadlock occurs if receives are blockingP1 . . . . .Receive(P2);Send(P2, M1);P2 . . . . .Receive(P1);Send(P1, M2);10Resource Allocation Graphs Directed graph that depicts a state of the system of resources and processes11Res

7、ource Allocation Graphs12Conditions for Deadlock Mutual exclusion Only one process may use a resource at a time Hold-and-wait A process may hold allocated resources while awaiting assignment of others No preemption No resource can be forcibly removed from a process holding it13Conditions for Deadloc

8、k Circular wait a closed chain of processes exists, such that each process holds at least one resource needed by the next process in the chain consequence of the first three conditions1415Conditions for Deadlock Mutual Exclusion No preemption Hold and wait Circular wait Each of these four conditions

9、 is necessary, and four conditions taken together constitute necessary and sufficient conditions for deadlock16Deadlock Prevention Design a system in such a way that the possibility of deadlock is excluded Mutual Exclusion Impracticable, operating systems must support the feature Hold and Wait Requi

10、re a process request all of its required resources at one time block the process until all requests can be granted simultaneously process may be held up for a long time waiting for all its requests resources allocated to a process may remain unused for a long time. These resources could be used by o

11、ther processes 17Deadlock Prevention No Preemption If a process is denied a further request, it must release resource and request again If a process requests a resource that is currently held by another process, OS may preempt this process to require it releases its resources Practical only when the

12、 state can be easily saved and restored later, such as processors Circular Wait Define a linear ordering of resource types such that once a resource is obtained, only those resources higher in the list can be obtained May deny resources unnecessarily18Deadlock Avoidance A decision is made dynamicall

13、y whether the current resource allocation request will, if granted, potentially lead to a deadlock Requires knowledge of future process request19Two Approaches to Deadlock Avoidance Do not start a process if its demands might lead to deadlock Resource allocation denial: Do not grant an incremental r

14、esource request to a process if this allocation might lead to deadlock20Resource Allocation Denial Referred to as Bankers Algorithm State of the system is the current allocation of resources to process Safe state is one in which there is at least one order in which all the processes can be run to co

15、mpletion without resulting in a deadlock Unsafe state is a state that is not safe21Determination of a Safe State Initial StateFigure 6.7 Determination of a safe State22Determination of a Safe State P2 Runs to CompletionFigure 6.7 Determination of a safe State23Determination of a Safe State P1 Runs to CompletionFigure 6.7 Determination of a safe State24Determination of a Safe State P3 Runs to CompletionFigure 6.7 Determination of a safe State25Determination of an Unsafe StateFigure 6.8 Determination of an Unsafe State26Determination of an Unsafe StateFigure 6.8 Determination of an Unsafe

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 高等教育 > 大学课件

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号