《操作系统》课程教学资源(PPT课件讲稿)Chapter 6 Concurrency Deadlock and Starvation

Chapter 6 Concurrency: Deadlock and Starvation Principals of Deadlock Deadlock prevention Deadlock avoidance Deadlock detection An Integrated deadlock strategy Dining Philosophers Problem
1 Chapter 6 Concurrency: Deadlock and Starvation • Principals of Deadlock – Deadlock prevention – Deadlock Avoidance – Deadlock detection – An Integrated deadlock strategy • Dining Philosophers Problem

Deadlock A set of processes is deadlocked when each process in the set is blocked awaiting an event that can only be triggered by another blocked process in the set Typically involves processes competing for the same set of resources The event is typically the freeing up of some requested resources No efficient solution
2 Deadlock • A set of processes is deadlocked when each process in the set is blocked awaiting an event that can only be triggered by another blocked process in the set – Typically involves processes competing for the same set of resources – The event is typically the freeing up of some requested resources • No efficient solution

Potential deadlock The necessary resources are available for any of the cars to proceed I need need quad C quad B and d and C b I need I need quad A and quad D B and A
3 Potential Deadlock I need quad A and B I need quad B and C I need quad C and D I need quad D and A The necessary resources are available for any of the cars to proceed

Actual deadlock HALT until HALT until D is free C is free HALT until HALT until B is free A is free
4 Actual Deadlock HALT until B is free HALT until C is free HALT until D is free HALT until A is free

TWo Processes P and Q Consider two Process P Process Q processes P and Q Get A Get B · Each needs exc| usIve Get B Get A access to a resourcea Release Release B and b for a period of Release B Release A time
5 Two Processes P and Q • Consider two processes P and Q • Each needs exclusive access to a resource A and B for a period of time

Joint Progress Diagram of Deadlock Q Release Deadlock is only inevitable if the Release Required B joint progress of Get A the two processes B deadlock creates a path that Get B enters the fatal region PI ess Get A Get B Release A Release B =both P and Q want resourceA =both P and Q want resource B Required = deadlock-inevitable region B Required th of P and Q eater-P-iexecuting and Q is waiting Vertical portion of path indicates Q is executing and P is waiting Figure 6.2 Example of Deadlock
6 Joint Progress Diagram of Deadlock Deadlock is only inevitable if the joint progress of the two processes creates a path that enters the fatal region

Alternative logic Whether or not deadlock Process P Process Q occurs depends on both GetA Get B the dynamics of the execution and on the Release A Get A details of the application Get B Release B Suppose that P does not Rel Release a need both resources at the same time
7 Alternative logic • Whether or not deadlock occurs depends on both the dynamics of the execution and on the details of the application • Suppose that P does not need both resources at the same time

Diagram of alternative logic Progress of Q 3 Release A Release Get a Required 5 Get B Deadlock 6 cannot occur Progress Get a Release a get b Release b both P and Q want resource A A Required B Required both P and Q want resource B ion of path indicates Pis executing and Q is waitin portion of path indicates Q is executing and Pis waiting 8 Figure 6.3 Example of No Deadlock [BACO031
8 Diagram of alternative logic Deadlock cannot occur

Resource Categories Two general categories of resources · Reusable can be safely used by only one process at a time and is not depleted by that use examples: processors, IO channels, main and secondary memory, devices, and data structures such as files, databases, and semaphores Consumable can be created (produced) and destroyed (consumed examples: interrupts, signals, messages, and information in l/o buffers
9 Resource Categories Two general categories of resources: • Reusable – can be safely used by only one process at a time and is not depleted by that use. – examples: processors, I/O channels, main and secondary memory, devices, and data structures such as files, databases, and semaphores • Consumable – can be created (produced) and destroyed (consumed) – examples: interrupts, signals, messages, and information in I/O buffers

Reusable resources EXample Consider two processes that compete for exclusive access to a disk file d and a tape drive t Process P Process Q Step Action Step Action Request D) Request (t) ppppppp Lock①D) Lock (T) Request t) Lock(T) qqqq Request (d) Lock①D) Perform function Perform function Unlock(D) Unlock(T) Unlock(T) Unlock D) Figure 6.4 Example of Two Processes Competing for Reusable Resources 10
10 Reusable Resources Example • Consider two processes that compete for exclusive access to a disk file D and a tape drive T
按次数下载不扣除下载券;
注册用户24小时内重复下载只扣除一次;
顺序:VIP每日次数-->可用次数-->下载券;
- 《操作系统》课程教学资源(PPT课件讲稿)Chapter 1 and 2 Computer System and Operating System Overview.ppt
- 印第安纳大学:《Informatics》课程PPT教学课件(信息学)08 网络爬虫 Web Crawling.ppt
- 《Java编程导论》课程教学资源(PPT课件讲稿)Chapter 8 Strings and Text I/O.ppt
- 《计算机网络与通讯》课程教学资源(PPT课件讲稿,英文版)Chapter 3 Transport Layer.ppt
- C++ Review.ppt
- 《计算机网络与通讯》课程教学资源(PPT课件讲稿,英文版)Chapter 07 Network Security.ppt
- Incorporating Structured World Knowledge into Unstructured Documents via——Heterogeneous Information Networks.pptx
- FairCloud:Sharing the Network in Cloud Computing.pptx
- 香港科技大学:《计算机网络 Computer Networks》课程教学资源(PPT课件)Chapter 1 Introduction of computer networking.ppsx
- Fluent:《GAMBIT建模教程》教学资源(PPT讲稿)Geometry Operations in GAMBIT.ppt
- 有限元分析 ANSYS:Modeling Turbulent Flows(PPT讲稿)Introductory FLUENT Training.ppt
- 隐马尔科夫模型和词性标注(PPT课件讲稿).ppt
- 哈尔滨工业大学:《中文信息处理》课程教学资源(PPT课件讲稿)句法分析(张宇).ppt
- 新乡学院:《计算机网络》课程教学大纲(适用专业:信息与计算科学).pdf
- 新乡学院:《数据库原理》课程电子教案(PPT课件)第3章 关系数据库.ppt
- 《数据库系统概论 An Introduction to Database System》课程教学资源(PPT课件讲稿)第8讲 数据库恢复技术.ppt
- 河南中医药大学:《网络技术实训》课程教学资源(PPT课件讲稿)第4讲 网络管理实训内容(上).pptx
- 河南中医药大学(河南中医学院):《计算机网络》课程教学资源(PPT课件讲稿)第六章 应用层.ppt
- 《计算机辅助设计——Photoshop制图》课程标准.pdf
- 《操作系统 Operating System》课程电子教案(PPT课件讲稿)第一章 简介.ppt
- 《操作系统》课程教学资源(PPT课件讲稿)Chapter 8 Virtual Memory.ppt
- 《图像处理与计算机视觉 Image Processing and Computer Vision》课程教学资源(PPT课件讲稿)Chapter 10 Pose estimation by the iterative method.pptx
- Introduction to Internet and TCPIP(PPT讲稿)IP转发 IP FORWARDING.pptx
- GD-Aggregate:A WAN Virtual Topology Building Tool for Hard Real-Time and Embedded Applications.ppt
- 《图像处理与计算机视觉 Image Processing and Computer Vision》课程教学资源(PPT课件讲稿)Chapter 05 Hough transform.pptx
- 香港中文大学:Image processing and computer vision(PPT课件讲稿)Edge detection and image filtering.pptx
- 《图像处理与计算机视觉 Image Processing and Computer Vision》课程教学资源(PPT课件讲稿)Chapter 07 Mean-shift and Cam-shift.pptx
- Essential Cluster OS Commands.ppt
- 香港浸会大学:Kickstart Tutorial/Seminar on using the 64-nodes P4-Xeon Cluster in Science Faculty.ppt
- 香港浸会大学:并行输入输出(PPT讲稿)Parallel I/O.ppt
- 四川大学:《操作系统 Operating System》课程教学资源(PPT课件讲稿)Chapter 7 Memory Management.ppt
- 四川大学:《数据库技术》课程教学资源(PPT课件讲稿)第4章 数据库查询.ppt
- 《计算机系统结构》课程教学资源(PPT课件讲稿)第五章 存储层次.ppt
- 软件配置管理和项目管理工具(PPT讲稿)Software Configuration Management and Project Management Tool.ppt
- 《数据库基础》课程PPT教学课件(SQL Server)第4章 T-SQL与可编程对象.ppt
- 《嵌入式系统开发》课程PPT教学课件(讲稿)第一章 嵌入式系统概述.ppt
- 《编译原理 Compiler Construction》课程教学资源(PPT讲稿)语义分析 Semantic Analysis(Attributes and Attribute Grammars、Algorithms for Attribute Computation).ppt
- 四川大学:《Linux操作系统》课程教学资源(PPT课件讲稿)第6章 Linux系统调用.ppt
- 《数据库技术》课程教学资源(PPT课件讲稿)第3章 SQL语言基础及数据定义功能(主讲:曾晓东).ppt
- 四川大学:.NET and .NET Core:Languages, Cloud, Mobile and AI(PPT课件讲稿)NET for Data Science and AI.pptx