- 1、有哪些信誉好的足球投注网站(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
浙江大学操作系统课件(Operating System Concepts)CH07.ppt
Chapter 7: Process Synchronization进程同步 7.1 Background 背景 7.2 The Critical-Section Problem 临界区问题 7.3 Synchronization Hardware 同步的硬件实现. 7.4 Semaphores 信号量 7.5 Classical Problems of Synchronization 经典同步问题 7.6 Critical Regions 临界区 7.7 Monitors 管程 7.8 OS Synchronization 操作系统的同步机制 7.9 Atomic Transactions 自动事务处理 7.1 Background背景 Concurrent access to shared data may result in data inconsistency. 对共享数据的并发访问可能导致数据的不一致性 Maintaining data consistency requires mechanisms to ensure the orderly execution of cooperating processes. 要保持数据的一致性,就需要一种保证并发进程的正确执行顺序的机制 Background (Cont.) Shared-memory solution to bounded-butter problem (Chapter 4) allows at most n – 1 items in buffer at the same time. A solution, where all N buffers are used is not simple. 第4章中解决有界缓冲区问题的共享内存方法在类数据count 上将一起竞争条件 Suppose that we modify the producer-consumer code by adding a variable counter, initialized to 0 and incremented each time a new item is added to the buffer Bounded-Buffer Shared data #define BUFFER_SIZE 10 typedef struct { . . . } item; item buffer[BUFFER_SIZE]; int in = 0; int out = 0; int counter = 0; Bounded-Buffer (Cont.-1) Producer process item nextProduced; while (1) { while (counter == BUFFER_SIZE) ; /* do nothing */ buffer[in] = nextProduced; in = (in + 1) % BUFFER_SIZE; counter++; } Bounded-Buffer (Cont.-2) Consumer process item nextConsumed; while (1) { while (counter == 0) ; /* do nothing */ nextConsumed = buffer[out]; out = (out + 1) % BUFFER_SIZE; counter--; } Bounded Buffer (Cont.-3) The statementscounter++;counter--;must be performed atomically. Atomic ope
您可能关注的文档
最近下载
- 255-20240615+《中庸》第4讲:《行明章》.docx VIP
- 高中语文课堂情境化多模态教学策略探究教学研究课题报告.docx
- 2025深度融合AI的低代码平台.pptx VIP
- 道路桥梁工程课件培训资料.ppt VIP
- ASME B16.5-2020 管法兰和法兰管件(中文版).pdf
- 人教版PEP小学五年级英语上册教案-全册.pdf VIP
- 《第7课 冒泡排序》课件.pptx VIP
- 必威体育精装版中小学校长选拔笔试试题及参考答案[教育].docx VIP
- DB62T 856-2002 无公害蔬菜番瓜(西葫芦)日光温室生产技术.pdf VIP
- TJYXFIA0002-2024 菜干团体标准.pdf VIP
文档评论(0)