《操作系统原理》课程教学资源(PPT课件讲稿)Chapter 05 并发性——互斥和同步(Concurrency - Mutual Exclusion and Synchronization)

CHAPTER 5 Concurrency: Mutual Exclusion and Synchronization (并发性:互斥和同步)

Concurrency (并发性) Communication among processes Sharing of and competing(竞争)or resources Synchronization of the activities of multiple processes Allocation of processor time to processer

Concurrency Multiple applications Multiprogramming Structured application Application can be a set of concurrent processes Operating-system structure Operating system is a set of processes or th reads

5.1 PRINCIPLES OF NCURRENCY (并发的原理) Difficulties with Concurrency 1. Sharing global resources 2. Management of allocation of resources 3. It become very difficult to locate a Programming errors

A Simple example procedure echo; Var out in: character; begin input (in, keyboard) out: s in outputout, display)i end

A Simple example Process p1 Process p2 Input(in, keyboard) Input(in, keyboard) Out: in ou七:=in Output(out, display) Output(out, display)

Operating System Concerns (操作系统关注的问题) Keep track of active processes: PCB Allocate and deallocate resources Processor time: scheduling Memory virtual memory Files 1o devices Protect data and resources Result of process must be independent of the speed of execution of other concurrent processes (应保证进程执行的结果与速度无关)

Process Interaction Processes unaware of each other Competition Mutual exclusion, Deadlock, starvation Processes indirectly aware of each other Cooperation by sharing Mutual exclusion Deadlock. Starvation. Data coherence (一致性) Process directly aware of each other Cooperation by communication Deadlock. Starvation
一致性)

表5.1进程的交互 知道程度 关系 个进程对其他进程的影响潜在的控制问题 进程之间不知道对竞争 个进程的结果与其它进互斥 方 程的活动无关 死锁(可复用的资 (进程间无工作联 2进程的分时可能会受到影源) 系) 响 饿死 进程间接知道对方通过共 个进程的结果可能依赖互斥 (如共享对象) 享合作于从其他进程获得的信息 死锁(可复用的资 2进程的分时可能会受到影源) 响 饿死 数据一致性 进程直接知道对方通过通1.一个进程的结果可能依赖死锁(可消费的资 (它们有可用的通信合作于从其他进程获得的信息 源 信原语) 2进程的分时可能会受到影饿死
表5.1进程的交互 知道程度 关系 一个进程对其他进程的影响 潜在的控制问题 进程之间不知道对 方 (进程间无工作联 系) 竞争 1 一个进程的结果与其它进 程的活动无关 2 进程的分时可能会受到影 响 互斥 死锁(可复用的资 源) 饿死 进程间接知道对方 (如共享对象) 通过共 享合作 1. 一个进程的结果可能依赖 于从其他进程获得的信息 2. 进程的分时可能会受到影 响 互斥 死锁(可复用的资 源) 饿死 数据一致性 进程直接知道对方 (它们有可用的通 信原语) 通过通 信合作 1. 一个进程的结果可能依赖 于从其他进程获得的信息 2. 进程的分时可能会受到影 响 死锁(可消费的资 源) 饿死

Competition Among processes for resources Mutual exclusion(互斥) Critical sections(临界区) Only one program at a time is allowed in its critical section(一次仅允许一个进程在临界区) Example only one process at a time is allowed to send command to the printer (critical resource (例如一次仅允许一个进程发打印命令) Deadlock(死锁) · Starvation
critical resource) (例如一次仅允许一个进程发打印命令)
按次数下载不扣除下载券;
注册用户24小时内重复下载只扣除一次;
顺序:VIP每日次数-->可用次数-->下载券;
- 《计算机体系结构》课程教学资源(PPT课件讲稿)第七章 多处理机系统.ppt
- 电子科技大学:《面向对象程序设计语言C++》课程教学资源(PPT课件讲稿)第九章 多态性(主讲:丘志杰).ppt
- 《操作系统》课程教学资源(PPT课件讲稿)Chapter 03 Process Description And Control.ppt
- 《计算机系统结构》课程教学资源(PPT课件讲稿)第五章 存储系统.ppt
- 电子科技大学:《计算系统与网络安全 Computer System and Network Security》课程教学资源(PPT课件讲稿)第2章 信息安全数学基础(计算复杂性).ppt
- 电子科技大学:《计算系统与网络安全 Computer System and Network Security》课程教学资源(PPT课件讲稿)第5章 网络隔离技术.ppt
- 电子科技大学:《计算系统与网络安全 Computer System and Network Security》课程教学资源(PPT课件讲稿)第7章 协议安全技术(安全协议实例).ppt
- 电子科技大学:《计算系统与网络安全 Computer System and Network Security》课程教学资源(PPT课件讲稿)第4章 网络基础(网络概述、协议).ppt
- 四川大学:《Matlab程序设计》课程教学资源(教学大纲)Programming in Matlab.pdf
- 四川大学:.NET and .NET Core:Languages, Cloud, Mobile and AI(PPT课件讲稿)NET for Data Science and AI.pptx
- 《数据库技术》课程教学资源(PPT课件讲稿)第3章 SQL语言基础及数据定义功能(主讲:曾晓东).ppt
- 四川大学:《Linux操作系统》课程教学资源(PPT课件讲稿)第6章 Linux系统调用.ppt
- 《编译原理 Compiler Construction》课程教学资源(PPT讲稿)语义分析 Semantic Analysis(Attributes and Attribute Grammars、Algorithms for Attribute Computation).ppt
- 《嵌入式系统开发》课程PPT教学课件(讲稿)第一章 嵌入式系统概述.ppt
- 《数据库基础》课程PPT教学课件(SQL Server)第4章 T-SQL与可编程对象.ppt
- 软件配置管理和项目管理工具(PPT讲稿)Software Configuration Management and Project Management Tool.ppt
- 《计算机系统结构》课程教学资源(PPT课件讲稿)第五章 存储层次.ppt
- 四川大学:《数据库技术》课程教学资源(PPT课件讲稿)第4章 数据库查询.ppt
- 四川大学:《操作系统 Operating System》课程教学资源(PPT课件讲稿)Chapter 7 Memory Management.ppt
- 香港浸会大学:并行输入输出(PPT讲稿)Parallel I/O.ppt
- 《计算机系统结构》课程教学资源(PPT课件讲稿)第八章 多计算机系统.ppt
- 《计算机系统结构》课程教学资源(PPT课件讲稿)第一章 计算机系统结构的基本概念.ppt
- 《数学建模》课程教学资源(PPT讲稿)SAS基础培训(生成SAS数据集、加工SAS数据集)Statistical Analysis System.ppt
- 《数字图像处理》课程教学资源(PPT课件讲稿)第8章 彩色图像处理.ppt
- 电子工业出版社:《计算机网络》课程教学资源(第五版,PPT课件讲稿)第8章 因特网上的音频/视频服务.ppt
- 《数字图像处理》课程教学资源(PPT课件讲稿)第4章 图像增强.ppt
- 郑州大学:《计算机组成原理》课程教学资源(PPT课件讲稿,共八章,任课教师:石磊).ppt
- 长沙医学院:《计算机专业英语》课程教学资源_教学大纲.doc
- 局域网基础知识及网络设备(PPT课件讲稿).ppt
- 广西医科大学:《计算机网络 Computer Networking》课程教学资源(PPT课件讲稿)Chapter 17 NETWORK MANAGEMENT.pptx
- 《PhotoshopCS2基础教程与上机指导》课程教学资源(PPT课件讲稿)第20章 Web图像与动画设计.ppt
- 深圳大学:《图片处理基础》课程教学课件(PPT讲稿)Poisson Image Editing.pptx
- 广西外国语学院:《计算机网络》课程教学资源(PPT课件讲稿)第8章 DNS.ppt
- 《C语言程序设计》课程教学资源(PPT课件讲稿)第5章 循环结构程序设计.ppt
- 《高级语言程序设计 Advanced Programming》课程教学资源(PPT课件讲稿)第8章 指针.ppt
- 《Java面向对象程序设计》课程教学资源(PPT课件讲稿)第四章 Java图形用户界面设计 4.2 AWT和Swing组件.pptx
- 江苏海洋大学(淮海工学院):《Java面向对象程序设计》课程教学资源(PPT课件讲稿)第2章 Java语言基础.pptx
- 江苏海洋大学(淮海工学院):《Java面向对象程序设计》课程教学资源(PPT课件讲稿)第4章 Java图形用户界面设计.pptx
- 《Java面向对象程序设计》课程教学课件(PPT讲稿)AWT和Swing组件.pptx
- 《Java面向对象程序设计》课程教学课件(PPT讲稿)流程控制语句.pptx