- 8
- 0
- 约3.8万字
- 约 140页
- 2019-05-06 发布于广东
- 举报
Chapter 2 Processes and Scheduling (II) Mutual Exclusion and Synchronization Principles of concurrency. Mutual Exclusion: Software approaches and Hardware Support. Semaphores、Monitors、Message Passing. Tradition question: Producer/Consumer、Readers/Writers Problem. Difficulties Arise in Concurrency Types: interleaving and overlapping. The sharing of global resources is fraught with peril. It is difficult for the OS to manage the allocation of resources optimally. It is difficult to locate a programming error, because results are typically not reproducible. Sharing can lead to problems Process P1 . input (in, keyboard) . out:=in output (out, display) . . Problems of Concurrent Resource competition: How to allocate the resource, and how to mutual exclusion access the critical resources. Execution sequence. Communication cooperation. Process Interaction (table5.1) Processes unaware of each other: OS needs to be concerned about competition for resources. Exp. Two independent applications may both want access to the same disk or file or printer. Processes indirectly aware of each other(e.g., shared object): The processes share access to some object such as I/O buffer. Processes directly aware of each other: Communicate with each other by name. Mutual Exclusion(P193) Critical resource: Only one process can access it at a time. Critical section:the portion of the program that uses critical resource. P194,fig5.1 Program mutualexclusion Const n-…; (*num of processes) Procedure P(i:integer) Begin repeat enter critical(R) critical section; exit critical(R) remainder forever End; Deadlock and Starvation(P194) Deadlock Exp. Two processes P1、P2, both request to resource R1、R2. At a time: P1 gets R2 and P2 gets R1, in the meantime P1 requests R1 and P2 requests R2 Then P1 and P2 wait for each other forever deadlock. Starvation P1 always communication with P2, p3 is starved. Cooperation among Processes by Sharing(p195) Data integrity Reading and writing
您可能关注的文档
- 滁州学院计算机与信息工程学院计算机网络课件第2讲 网络体系结构.ppt
- 滁州学院计算机与信息工程学院计算机网络课件第4讲 信道复用与数字传输技术.ppt
- 滁州学院计算机与信息工程学院计算机网络课件第6讲 数据链路层(2).ppt
- 滁州学院计算机与信息工程学院计算机网络课件第7讲 局域网(1).ppt
- 滁州学院计算机与信息工程学院计算机网络课件第8讲 局域网(2).ppt
- 滁州学院计算机与信息工程学院计算机网络课件第9讲 局域网(3).ppt
- 滁州学院计算机与信息工程学院计算机网络课件第11讲 网络层(2).ppt
- 滁州学院计算机与信息工程学院计算机网络课件第12讲 网络层(3).ppt
- 滁州学院计算机与信息工程学院计算机网络课件第13讲 网络层(4).ppt
- 滁州学院计算机与信息工程学院计算机网络课件第14讲 网络层(5).ppt
- 中国国家标准 GB/T 6675.9-2025玩具安全 第9部分:化学及类似活动的实验玩具.pdf
- 《GB/T 6675.9-2025玩具安全 第9部分:化学及类似活动的实验玩具》.pdf
- GB/T 46975-2025婴童用品 便携式婴儿睡篮技术要求.pdf
- 中国国家标准 GB/T 46975-2025婴童用品 便携式婴儿睡篮技术要求.pdf
- 《GB/T 46975-2025婴童用品 便携式婴儿睡篮技术要求》.pdf
- 《GB/T 6675.14-2025玩具安全 第14部分:指画颜料要求和测试方法》.pdf
- GB/T 6675.14-2025玩具安全 第14部分:指画颜料要求和测试方法.pdf
- 中国国家标准 GB/T 6675.14-2025玩具安全 第14部分:指画颜料要求和测试方法.pdf
- 中国国家标准 GB/T 33772.3-2025质量评定体系 第3部分:印制板及层压板最终产品检验及过程监督用抽样方案的选择和使用.pdf
- 《GB/T 33772.3-2025质量评定体系 第3部分:印制板及层压板最终产品检验及过程监督用抽样方案的选择和使用》.pdf
原创力文档

文档评论(0)