四川大学:《操作系统 Operating System》课程教学资源(PPT课件讲稿)Chapter 5 互斥与同步(Mutual Exclusion and Synchronization)5.1 Principles of Concurrency 5.2 Mutual Exclusion

Chapter 5 Mutual Exclusion and Synchronization 5.1 Principles of Concurrency ·5.2 Mutua|EXc| usion 5.3 Semaphores ·54 Monitors 5.5 Message Passing 5.6 Readers /writers problem .5. Summary
2 Chapter 5 Mutual Exclusion and Synchronization • 5.1 Principles of Concurrency • 5.2 Mutual Exclusion • 5.3 Semaphores • 5.4 Monitors • 5.5 Message Passing • 5.6 Readers/Writers Problem • 5.7 Summary

5.1 Principles of Concurrency .5.1.0 What is concurrency .5.1.1 A Simple example ·5.1.2 Race condition 5.1.3 Operating System Concerns 5.1. 4 Process Interaction 5.1.5 Requirements for Mutual Exclusion
5.1 Principles of Concurrency • 5.1.0 What is concurrency • 5.1.1 A Simple Example • 5.1.2 Race Condition • 5.1.3 Operating System Concerns • 5.1.4 Process Interaction • 5.1.5 Requirements for Mutual Exclusion 3

5.1.0 What is concurrency (1/5) Operating System design is concerned with the management of processes and threads Multiprogramming multiple processes within a uniprocessor system Multiprocessing multiple processes within a multiprocessor Distributed processing multiple processes within distributed computer systems, such as clusters
5.1.0 What is concurrency(1/5) • Operating System design is concerned with the management of processes and threads: • Multiprogramming • multiple processes within a uniprocessor system • Multiprocessing • multiple processes within a multiprocessor • Distributed Processing • multiple processes within distributed computer systems, such as clusters 4

5.1.0 What is concurrency (2/5) Concurrency The execution of two or more process simultaneously
5.1.0 What is concurrency(2/5) • Concurrency • The execution of two or more process simultaneously. 5

5.1.0 What is concurrency (3/5) Concurrent and Parallel Programming Concurren Twe Queues C~c-q「a 吴吴吴天是奚呈玉玉 uu.cs Coe -fece Facties 長菜王玉王买买是 天天吴头天玉 Concurrent: 2 queues and 1 coffee machine Parallel: 2 queues and 2 coffee machines
5.1.0 What is concurrency(3/5) • Concurrent and Parallel Programming • Concurrent: 2 queues and 1 coffee machine • Parallel: 2 queues and 2 coffee machines 6

5.1.0 What is concurrency(4/5) Difficulties of Concurrency Sharing of variables Optimal management of resource allocation Locating programming errors(cannot reproduce) because of following facts relative speed of execution of processes is not predictable system interrupts are not predictable scheduling policies may vary
5.1.0 What is concurrency(4/5) • Difficulties of Concurrency • Sharing of variables • Optimal management of resource allocation • Locating programming errors (cannot reproduce) • because of following facts: • relative speed of execution of processes is not predictable. • system interrupts are not predictable • scheduling policies may vary 7

5.1.0 What is concurrency(5/5 Table 5.1 Some Key Terms Related to Concurrency atomic operation A sequence of one or more statements that appears to be indivisible; that is, no other process can see an intermediate state or interrupt the operation critical section a section of code within a process that requires access to shared resources and that must not be executed while another process is in a corresponding section of code deadlock A situation in which two or more processes are unable to proceed because each is waiting for one of the others to do something livelock A situation in which two or more processes continuously change their states in response to changes in the other process(es) without doing any useful work mutual exclusion The requirement that when one process is in a critical section that accesses shared resources, no other process may be in a critical section that accesses any of those shared resources. race condition A situation in which multiple threads or processes read and write a shared data item and the final result depends on the relative timing of their execution starvation A situation in which a runnable process is overlooked indefinitely by the scheduler; although it is able to proceed, it is never chosen
8 5.1.0 What is concurrency(5/5)

5.1 Principles of concurrent 5.1.0 What is concurrency 5.1.1 A Simple Example of shared variable ·5.1.2 Race condition 5.1.3 Operating System Concerns 5.1. 4 Process Interaction 5.1.5 Requirements for Mutual Exclusion
5.1 Principles of Concurrency • 5.1.0 What is concurrency • 5.1.1 A Simple Example of shared variable • 5.1.2 Race Condition • 5.1.3 Operating System Concerns • 5.1.4 Process Interaction • 5.1.5 Requirements for Mutual Exclusion 9

5.1.1 A Simple Example( 1/4 Consider the following procedure echo which is global to all applications char chin chou void echo chin getchar shout chin putchar(chou)
10 5.1.1 A Simple Example(1/4) • Consider the following procedure echo • which is global to all applications char chin, chout; void echo() { chin = getchar(); chout = chin; putchar(chout); }

5.1.1 A Simple Example( 2/4 Uniprocessor Process p1 Process p2 chin getchar(ix chou chini chin getchar()iY putchar(chou)i ch。ut=chin; putchar(chou)i
11 5.1.1 A Simple Example(2/4) . chin = getchar(); chout = chin; . putchar(chout); . . . Process P2 . . . chin = getchar(); . chout = chin; putchar(chout); . Process P1 . Uniprocessor: Y X
按次数下载不扣除下载券;
注册用户24小时内重复下载只扣除一次;
顺序:VIP每日次数-->可用次数-->下载券;
- 中国科学技术大学:《计算机网络 Computer Networks(计算机通信网)》课程教学资源(PPT课件讲稿)Chapter 06 Internet Protocol.ppt
- 构建互联互通的单位局域网(PPT讲稿).ppt
- 安徽理工大学:《汇编语言》课程教学资源(PPT课件讲稿)第八章 输入输出程序设计.ppt
- 中国科学技术大学:《信号与图像处理基础 Signal and Image Processing》课程教学资源(PPT课件讲稿)空域滤波 Spatial Filtering.pptx
- 广西医科大学:《计算机网络 Computer Networking》课程教学资源(PPT课件讲稿)Chapter 03 Network Management and Operation(Network Architetures and Standarts).pptx
- 《电子商务实用教程》课程教学资源(PPT课件讲稿)第三章 网络营销.ppt
- 河南中医药大学:《网络技术实训》课程教学资源(PPT课件讲稿)第7讲 网络安全实训(主讲:许成刚).pptx
- 《计算机应用基础》工学结合配套课件(PPT讲稿)模块二系统软件操作技术(Windows XP的实用工具).ppt
- 《C++程序设计》教学资源(PPT课件讲稿)构造函数和析构函数.ppt
- 《程序设计语言》课程教学资源(PPT课件讲稿)第5章 函数式程序设计语言.ppt
- 南京大学:移动Agent系统支撑(PPT讲稿)Agent Mobility Software Agent.pptx
- 计算机硬件维护(PPT课件讲稿).ppt
- 《MATLAB程序设计》课程教学资源(教学大纲)Matlab programming.doc
- 普林斯顿大学:平衡查找树(PPT讲稿)New Balanced Search Trees.pptx
- 清华大学:Top-k String Similarity Search with Edit-Distance Constraints.pptx
- 上海交通大学:网络安全 Network Security(PPT讲稿,朱浩瑾).pptx
- 《单片机原理及应用》课程教学资源_本科教学大纲汇编(电子信息工程专业).doc
- 广西外国语学院:《计算机网络》课程教学资源(PPT课件讲稿)第10章 应用层协议.ppt
- 《计算机网络》课程教学资源(PPT课件讲稿)第三章 局域网与校园网设计(网络方案设计).ppt
- 上海交通大学:人工智能的历史和启示——人机对弈作为案例.ppt
- 电子工业出版社:《计算机网络》课程教学资源(第五版,PPT课件讲稿)第五章 运输层.ppt
- 电子科技大学:《计算机操作系统》课程教学资源(PPT课件)第一章 操作系统引论.ppt
- 南京大学:《编译原理》课程教学资源(PPT课件讲稿)第三章 词法分析.ppt
- 同济大学:FWA for Noisy Optimization Problems(张军旗).pptx
- 西安培华学院:《计算机应用基础》课程教学资源(PPT课件讲稿)第1章 信息技术与计算机基础知识.ppt
- 香港科技大学:Recent Development of Heterogeneous Information Networks - From Meta-paths to Meta-graphs.pptx
- 《C语言程序设计》课程电子教案(PPT课件讲稿)第9章 文件操作.ppt
- 理论计算机科学(PPT专题讲稿)Topics in Theoretical Computer Science(Linear Programming).pptx
- 北京建筑大学:《计算机图形学》课程教学资源(PPT课件讲稿)第一章 绪论(吕书强).ppt
- 清华大学:《计算机导论》课程电子教案(PPT教学课件)第5章 程序设计知识.ppt
- 中国科学技术大学:《计算机文化基础》课程教学资源(PPT课件讲稿,共四章,李金龙).ppt
- 《自然语言处理》课程教学资源(PPT课件讲稿)语言模型.ppt
- 《计算机网络》课程教学资源(PPT课件讲稿)第7章 运输层.ppt
- 河南中医药大学(河南中医学院):《计算机文化》课程教学资源(PPT课件讲稿)第八章 数字多媒体.ppt
- 丽水职业技术学院:《电子商务实训》课程教学资源(PPT课件讲稿)电子商务交易模式之“B2C”.ppt
- 中国科学技术大学:《数据结构》课程教学资源(PPT课件)第八章 查找表.pps
- 《数据结构》课程教学资源(PPT课件讲稿)第九章 排序 Sort.ppt
- 《微机原理》课程教学资源(PPT课件讲稿)第三章 寻址方式与指令系统.ppt
- 《数据结构和编程设计》课程教学资源(PPT课件讲稿)Chapter 1 Programming Principles.ppt
- 西安电子科技大学:人工神经网络(PPT讲稿)Artificial Neural Networks(Introduction).ppt