电子科技大学:《计算机操作系统》课程教学资源(PPT课件讲稿)第二章 进程与调度(Processes and Scheduling)

Mutual Exclusion and Synchronization s Principles of concurrency Mutual Exclusion: Software approaches and hardware Support. ☆ Semaphores、 Monitors、 Message passing Tradition question: Producer/Consumer, Readers/Writers Problem PROCESSES AND SCHEDULING
PROCESSES AND SCHEDULING 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 s Types: interleaving and overlapping The sharing of global resources is fraught with e 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. PROCESSES AND SCHEDULING
PROCESSES AND SCHEDULING 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 Process P2 input (in, keyboard) input(in, keyboard) out:=in out: =in output (out, display output (out, display) So, it is necessary to protect shared global variables PROCESSES AND SCHEDULING
PROCESSES AND SCHEDULING Sharing can lead to problems Process P1 . input (in, keyboard) . out:=in output (out, display) . . Process P2 . input (in, keyboard) . out:=in output (out, display) . . So, it is necessary to protect shared global variables

Problems of concurrent Resource competition: How to allocate the resource and how to mutual exclusion access the critical resources 令 Execution sequence .o Communication cooperation PROCESSES AND SCHEDULING
PROCESSES AND SCHEDULING 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(tables1) 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 s Processes indirectly aware of each other(e.g, shared object): The processes share access to some object such as wo buffer Processes directly aware of each other: Communicate with each other by name. PROCESSES AND SCHEDULING
PROCESSES AND SCHEDULING 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) B Critical resource: Only one process can access it at a time Critical section: the portion of the program that uses critical resource entry section critical secion exit section PROCESSES AND SCHEDULING
PROCESSES AND SCHEDULING 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. entry section critical section exit section

P194,fig5.1 Program mutualexclusion Begin(main progra Const n-.; * num of processes) parbegin Procedure P(i: integer) Begin p2; repea enter critical(r) png aren : pa End exit critical(R orever End PROCESSES AND SCHEDULING
PROCESSES AND SCHEDULING P194,fig5.1 Program mutualexclusion Const n-…; (*num of processes) Procedure P(i:integer) Begin repeat enter critical(R) ; exit critical(R) forever End; Begin(*main program*) parbegin p1; p2; … pn; parend End

Deadlock and Starvation(P194) Deadlock Exp. Two processes Pl, P2, both request to resource riv R2. At a time: PI gets R2 and p2 gets rl, in the meantime pl requests RI and p2 requests r2 s Then pi and p2 wait for each other forever -deadlock. ☆ Starvation Pl always communication with P2, p3 is starved PROCESSES AND SCHEDULING
PROCESSES AND SCHEDULING 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 s Reading and writing, and only writing operations must be exclusive Data coherence: a=b no longer holds P1:a:=a+1 a:=a+1 b:=b+1 b:=2b P2:b:=2*b b:=b+1 a:=2a a:=2*a PROCESSES AND SCHEDULING
PROCESSES AND SCHEDULING Cooperation among Processes by Sharing(p195) ❖ Data integrity ٭ Reading and writing, and only writing operations must be exclusive. ❖ Data coherence: a=b no longer holds P1: a:=a+1 b:=b+1 P2: b:=2*b a:=2*a a:=a+1 b:=2*b b:=b+1 a:=2*a

Cooperation among Processes by Communication Synchronize: The processes send and receive data between each other coordinately. PROCESSES AND SCHEDULING
PROCESSES AND SCHEDULING Cooperation among Processes by Communication ❖ Synchronize: The processes send and receive data between each other coordinately
按次数下载不扣除下载券;
注册用户24小时内重复下载只扣除一次;
顺序:VIP每日次数-->可用次数-->下载券;
- 北京航空航天大学:《数据挖掘——概念和技术(Data Mining - Concepts and Techniques)》课程教学资源(PPT课件讲稿)Chapter 05 Mining Frequent Patterns, Association and Correlations.ppt
- 计算机算法(PPT讲稿)禁忌搜索算法 Tabu Search.ppt
- 2019年《计算机网络》考试大纲.doc
- 四川大学:《数据结构》课程教学资源(PPT课件讲稿)第五章 树和二叉树 Tree & Binary Tree.ppt
- 佛山科学技术学院:《网络技术基础》课程教学资源(专业技能考试大纲).doc
- 《计算机操作系统》课程教学资源(PPT课件讲稿)第二章 进程描述与控制 Process Concept & Process Control.ppt
- 香港城市大学:PROGRAMMING METHODOLOGY AND SOFTWARE ENGINEERING.ppt
- 《计算机网络》课程教学资源(PPT课件讲稿)第8章 应用层.ppt
- 并行处理(PPT讲稿)Parallel Processing - Hypercubes and Their Algorithms.ppt
- 《计算机网络》课程电子教案(PPT课件讲稿)第2章 数据通信的基础知识.ppt
- 《Excel高级应用》课程教学资源:课程教学大纲.doc
- 新乡学院:《办公自动化》课程教学资源(教学大纲).pdf
- 《视频制作》课程教学资源:课程教学大纲.doc
- 上海师范大学:《R语言与统计分析》课程教学资源(PPT课件)R语言——介绍(主讲:汤银才).ppt
- 南京大学:移动Agent系统支撑(PPT讲稿)Agent Mobility Software Agent(主讲:余萍).pptx
- 赣南师范大学:《计算机网络原理》课程教学资源(PPT课件讲稿)第四章 数据链路层.ppt
- 上海交通大学:《Multicore Architecture and Parallel Computing》课程教学资源(PPT课件讲稿)Lecture 8 CUDA, cont’d.ppt
- 东南大学:《操作系统概念 Operating System Concepts》课程教学资源(PPT课件讲稿)06 Process synchronization.ppt
- 河南中医药大学:《数据库原理》课程教学资源(PPT课件讲稿)第一章 绪论.ppt
- 中国科学技术大学:《计算机体系结构》课程教学资源(PPT课件讲稿)第4章 存储层次结构设计.ppt
- 交互式数据语言(PPT讲稿)Basic IDL knowledge.ppt
- 江苏海洋大学(淮海工学院):《Java面向对象程序设计》课程教学资源(PPT课件讲稿)全国二级Java考试的重点难点.pptx
- 长春工业大学:《Javascript 程序设计》课程教学资源(PPT课件讲稿)第8章 网页特效 JavaScript.ppt
- 《计算机组成原理》课程教学资源(PPT课件讲稿)第三章 CPU子系统.ppt
- 南京大学:移动Agent系统支撑(PPT讲稿)Mobile Agent Communication——Software Agent.pptx
- PROGRAMMING METHODOLOGY AND SOFTWARE ENGINEERING.ppt
- 《SQL Server 2000数据库教程》教学资源(PPT课件讲稿)第11章 数据库安全性管理.ppt
- 白城师范学院:《数据库系统概论 An Introduction to Database System》课程教学资源(PPT课件讲稿)第五章 数据库完整性.pptx
- 香港城市大学:《计算机图形学》课程教学资源(PPT课件讲稿)图的算法 Graph Algorithms.ppt
- 《The C++ Programming Language》课程教学资源(PPT课件讲稿)Lecture 07 Exception Handling.ppt
- 《C语言程序设计》课程教学资源(PPT课件讲稿)第9章 用户自己建立数据类型.pptx
- 《计算机网络教程》课程PPT教学课件(第三版)第3章 网络体系结构与网络协议.ppt
- 西安交通大学:《物联网技术导论》课程教学资源(PPT课件)第一章 物联网技术概论(主讲:桂小林).ppt
- 电子科技大学:《计算机操作系统》课程教学资源(PPT课件讲稿)第二章 进程与调度 Processes and Scheduling.ppt
- 《Web网站设计与开发》课程教学资源(PPT课件讲稿)第10章 Java Web实用开发技术.ppt
- 可信计算 Trusted Computing(PPT讲稿)TSS - TCG Software Stack.ppt
- 西安电子科技大学:《现代密码学》课程教学资源(PPT课件讲稿)第一章 绪论(主讲:董庆宽).pptx
- 《VB程序设计》课程教学资源(PPT课件讲稿)第二章 VB语言基础.ppt
- 《计算机网络》课程教学大纲 Computer Networks.pdf
- 《Photoshop教程》教学资源(PPT课件)第6章 Photoshop的绘图工具.ppt