四川大学操作系统课件.ppt

四川大学操作系统课件.ppt

ID:59472921

大小:1.15 MB

页数:84页

时间:2020-09-14

四川大学操作系统课件.ppt_第1页
四川大学操作系统课件.ppt_第2页
四川大学操作系统课件.ppt_第3页
四川大学操作系统课件.ppt_第4页
四川大学操作系统课件.ppt_第5页
资源描述:

《四川大学操作系统课件.ppt》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库

1、Chapter5MutualExclusion(互斥)andSynchronization(同步)OperatingSystems1Agenda5.1PrinciplesofConcurrency5.2MutualExclusion:HardwareSupport5.3Semaphores5.4Monitors5.5MessagePassing5.6Readers/WritersProblem5.7Summary2ConcurrencyConcurrencyarisesinthreedifferentcontexts:Multipleapplications(多应用程序)Multipro

2、grammingStructuredapplication(结构化应用程序)SomeapplicationcanbedesignedasasetofconcurrentprocessesOperating-systemstructure(操作系统结构)Operatingsystemisasetofprocessesorthreads3Concurrency临界区死锁活锁互斥竞争条件饥饿45.1PrinciplesofConcurrency5.1.1ASimpleExample5.1.2RaceCondition5.1.3OperatingSystemConcerns5.1.4Proces

3、sInteraction5.1.5RequirementsforMutualExclusion5DifficultiesofConcurrencySharingofglobalresourcesOperatingsystemmanagingtheallocationofresourcesoptimallyDifficulttolocateprogrammingerrors6ASimpleExamplecharchin,chout;voidecho(){chin=getchar();chout=chin;putchar(chout);}7ASimpleExample(Uniprocesso

4、r)ProcessP1ProcessP2..chin=getchar();.chout=chin;.chin=getchar();chout=chin;putchar(chout);putchar(chout);...8ASimpleExample(Multiprocessor)ProcessP1ProcessP2..chin=getchar();..chin=getchar();chout=chin;chout=chin;putchar(chout);..putchar(chout);..95.1PrinciplesofConcurrency5.1.1ASimpleExample5.1

5、.2RaceCondition5.1.3OperatingSystemConcerns5.1.4ProcessInteraction5.1.5RequirementsforMutualExclusion10RaceCondition(竞争条件)Araceconditionoccurswhenmultipleprocessesorthreadsreadandwritedataitemssothatthefinalresultdependsontheorderofexecutionofinstructionsinthemultipleprocessesorthread.(竞争条件发生在当多个

6、进程或者线程在读写数据时,其最终结果依赖于多个进程或者线程的指令执行顺序)115.1PrinciplesofConcurrency5.1.1ASimpleExample5.1.2RaceCondition5.1.3OperatingSystemConcerns5.1.4ProcessInteraction5.1.5RequirementsforMutualExclusion12OperatingSystemConcernsKeeptrackofvariousprocesses(throughPCB)AllocateanddeallocateresourcesProcessortimeMe

7、moryFilesI/OdevicesProtectdataandresourcesOutputofprocessmustbeindependentofthespeedofexecutionofotherconcurrentprocesses135.1PrinciplesofConcurrency5.1.1ASimpleExample5.1.2RaceCondition5.1.3OperatingSystemConcerns5.1.

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。