《操作系统原理与设计 Operating System Principles and Implementation》课程教学课件(英文讲稿)Chapter 5 Process Communication & Synchronization(part1)

OperatingSystemsCh5Process Communication & Synchronization1
Operating Systems Ch5 Process Communication & Synchronization 1

Story so far..· Process concept + operations- Programmer's perspective + kernel's perspectiveThread-Lightweight process We mainly talked about the stuffs related to a singleprocess/thread, what if multiple processes exist..2
Story so far. • Process concept + operations – Programmer’s perspective + kernel’s perspective • Thread – Lightweight process • We mainly talked about the stuffs related to a single process/thread, what if multiple processes exist. 2

Processes. The processes within a system may be-independent or: Independent process cannot affect or be affected by otherprocesses-cooperating· Cooperating process can affect or be affected by otherprocesses Note: Any process that shares data with others is acooperating process3
3 Processes • The processes within a system may be – independent or • Independent process cannot affect or be affected by other processes – cooperating • Cooperating process can affect or be affected by other processes • Note: Any process that shares data with others is a cooperating process

CooperatingProcesses. Why we need cooperating processes-Information sharing: e.g., shared file-Computationspeedup·executing subtasks inparallel-Modularity: dividing system functions into separate processes-Convenience: single user can have multiple processes to execute many tasks4
4 Cooperating Processes • Why we need cooperating processes – Information sharing • e.g., shared file – Computation speedup • executing subtasks in parallel – Modularity • dividing system functions into separate processes – Convenience • single user can have multiple processes to execute many tasks

s communication (IPC)Inter-process- What and how?
5 P P P Inter-process communication (IPC) - What and how?

Interprocess Communication· IPC: used for exchanging data between processes- Cooperating processes need·interprocess communication (IpC)for exchanging dataHow to illustrate? Paradigm for cooperating processes Producer-consumer problem, useful metaphor for manyapplications (abstractedproblem model)producer process produces information that is consumed by aconsumerprocess·Atleastoneproducerandoneconsumer6
6 Interprocess Communication • IPC: used for exchanging data between processes – Cooperating processes need • interprocess communication (IPC) for exchanging data • How to illustrate? – Paradigm for cooperating processes – Producer-consumer problem, useful metaphor for many applications (abstracted problem model) • producer process produces information that is consumed by a consumer process • At least one producer and one consumer

Two models Two (abstracted) models of IPC-Sharedmemory: Establish a shared memory region, read/write to shared region.Accesses aretreated as routine memory accesses·FasterprocessAsharedmemoryprocess Bkernel7
7 Two models • Two (abstracted) models of IPC – Shared memory • Establish a shared memory region, read/write to shared region • Accesses are treated as routine memory accesses • Faster

Two models Two (abstracted) models of IPC-Messagepassing·Exchange message.Requirekernel intervention·EasiertoimplementindistributedsystemprocessAprocess BmessagegueuemTkernel8
8 Two models • Two (abstracted) models of IPC – Message passing • Exchange message • Require kernel intervention • Easier to implement in distributed system

Shared Memory.Producer-consumerproblem- A buffer is needed to allow processes to run concurrentlyProducerConsumerdequeueenqueuebounded/unboundedbuffer-Itisasharedobject;Abuffer-It is a queue (imagine that it is an array implementation of queue)Aproducer-Itproducesaunitofdata,and-writesthata pieceof data tothetail of thebufferat onetime.process-It removes a unit of datafromthehead of thebounded buffer atAconsumerone time.process9
Shared Memory • Producer-consumer problem – A buffer is needed to allow processes to run concurrently 9 A buffer -It is a shared object; -It is a queue (imagine that it is an array implementation of queue). A producer process -It produces a unit of data, and -writes that a piece of data to the tail of the buffer at one time. A consumer process -It removes a unit of data from the head of the bounded buffer at one time. bounded/unbounded buffer Producer enqueue dequeue Consumer

Shared Memory. Focus on bounded buffer: what are the requirements?Whentheproducerwantsto(a)putanewiteminthebuffer,but(b)thebufferis already full..Producer-consumerThen,requirement #1(1)Theproducershouldbe suspended,and(2)Theconsumershouldwaketheproducerupaftershehasdequeued an item.Whentheconsumerwantsto(a)consumesanitemfromthebuffer,but(b) the buffer is empty..Producer-consumerThen,requirement #2(1)Theconsumershouldbesuspended,and(2)Theproducershouldwaketheconsumerupaftershehasenqueuedanitem10
Shared Memory 10 Producerconsumer requirement #1 When the producer wants to (a) put a new item in the buffer, but (b) the buffer is already full. Producerconsumer requirement #2 When the consumer wants to (a) consumes an item from the buffer, but (b) the buffer is empty. Then, (1) The producer should be suspended, and (2) The consumer should wake the producer up after she has dequeued an item. Then, (1) The consumer should be suspended, and (2) The producer should wake the consumer up after she has enqueued an item. • Focus on bounded buffer: what are the requirements?
按次数下载不扣除下载券;
注册用户24小时内重复下载只扣除一次;
顺序:VIP每日次数-->可用次数-->下载券;
- 《操作系统原理与设计 Operating System Principles and Implementation》课程教学课件(英文讲稿)Chapter 4 Threads.pdf
- 《操作系统原理与设计 Operating System Principles and Implementation》课程教学课件(英文讲稿)Chapter 3 Process Concepts & Operations(part2)from Kernel's Perspective.pdf
- 《操作系统原理与设计 Operating System Principles and Implementation》课程教学课件(英文讲稿)Chapter 3 Process Concepts & Operations(part1).pdf
- 《操作系统原理与设计 Operating System Principles and Implementation》课程教学课件(英文讲稿)Chapter 2 Operating System Structures.pdf
- 《操作系统原理与设计 Operating System Principles and Implementation》课程教学课件(英文讲稿)Chapter 1 Overview of an Operating System.pdf
- 《计算机网络》课程教学资源(PPT课件)第六章 应用层.pptx
- 《计算机网络》课程教学资源(PPT课件)第五章 传输层.pptx
- 《计算机网络》课程教学资源(PPT课件)第四章 网络层.pptx
- 《计算机网络》课程教学资源(PPT课件)第三章 数据链路层.pptx
- 《计算机网络》课程教学资源(PPT课件)第二章 物理层.pptx
- 《计算机网络》课程教学资源(PPT课件)第一章 概述.pptx
- 《智能算法设计与应用》课程教学大纲 Intelligent Algorithm Design and Application.docx
- 《数字导航技术》课程教学资源(书籍文献)计算机视觉-马颂德.pdf
- 《C语言程序设计》课程参考文献:Programming languages — C(PDF电子书,英文版).pdf
- 《操作系统》课程教学资源(PPT课件)课程简介 Operating System.pptx
- 《操作系统》课程教学资源(PPT课件)第1章 操作系统引论.pptx
- 《操作系统》课程教学资源(PPT课件)第2章 进程的描述和控制.pptx
- 《操作系统》课程教学资源(PPT课件)第3章 处理机调度与死锁.pptx
- 《操作系统》课程教学资源(PPT课件)第5章 虚拟存储器.pptx
- 《操作系统》课程教学资源(PPT课件)第6章 输入输出系统.pptx
- 《操作系统原理与设计 Operating System Principles and Implementation》课程教学课件(英文讲稿)Chapter 5 Process Communication & Synchronization -Part 2.pdf
- 《操作系统原理与设计 Operating System Principles and Implementation》课程教学课件(英文讲稿)Chapter 6 Process Scheduling.pdf
- 《操作系统原理与设计 Operating System Principles and Implementation》课程教学课件(英文讲稿)Chapter 7 Memory Management part1.pdf
- 《操作系统原理与设计 Operating System Principles and Implementation》课程教学课件(英文讲稿)Chapter 7 Memory Management part2.pdf
- 《操作系统原理与设计 Operating System Principles and Implementation》课程教学课件(英文讲稿)Chapter 8 Mass Storage.pdf
- 《操作系统原理与设计 Operating System Principles and Implementation》课程教学课件(英文讲稿)Chapter 9 File Systems part1.pdf
- 《操作系统原理与设计 Operating System Principles and Implementation》课程教学课件(英文讲稿)Chapter 9 File Systems part2.pdf
- 《操作系统原理与设计 Operating System Principles and Implementation》课程教学课件(英文讲稿)Chapter 10 Details of FAT32.pdf
- 《操作系统原理与设计 Operating System Principles and Implementation》课程教学课件(英文讲稿)Chapter 10 Details of Ext2/3 File System.pdf
- 北京工业大学:信息科学技术学院《C#程序设计基础》课程教学大纲 Fundamentals of Programming Principle and Practice in C#.pdf
- 北京工业大学:计算机学院本科课程教学大纲汇编(2024).pdf
- 揭阳职业技术学院:《计算机应用基础》课程授课教案(讲义,2025).pdf
- 《C语言程序设计》课程教学课件(PPT讲稿)第10章 对文件的输入输出.pptx
- 《C语言程序设计》课程教学课件(PPT讲稿)第01章 程序设计和C语言.pptx
- 《C语言程序设计》课程教学课件(PPT讲稿)第02章 算法——程序的灵魂.pptx
- 《C语言程序设计》课程教学课件(PPT讲稿)第03章 最简单的C程序设计——顺序程序设计.pptx
- 《C语言程序设计》课程教学课件(PPT讲稿)第04章 选择结构程序设计.pptx
- 《C语言程序设计》课程教学课件(PPT讲稿)第05章 循环结构程序设计.pptx
- 《C语言程序设计》课程教学课件(PPT讲稿)第06章 利用数组处理批量数据.pptx
- 《C语言程序设计》课程教学课件(PPT讲稿)第07章 用函数实现模块化程序设计.pptx
