操作系统期中作业(答案)精编版_第1页
操作系统期中作业(答案)精编版_第2页
操作系统期中作业(答案)精编版_第3页
操作系统期中作业(答案)精编版_第4页
操作系统期中作业(答案)精编版_第5页
已阅读5页,还剩5页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

操作系统期中作业(答案)PAGEPAGE3操作系统期中作业姓名:___学号:专业:一、Foreachofthefollowingstatements,ChoosingTrueorFalseBinarysemaphoresarethosethatareusedbynomorethantwothreads.FTheBanker'salgorithmisawayofpreventingdeadlock.FAmulti-levelindexedfilepermitsfasterrandomaccessthanacontiguouslyallocatedfile.FAnatomicoperationisamachineinstructionorasequenceofinstructionsthatmustbeexecutedtocompletionwithoutinterruption.TDeadlockisasituationinwhichtwoormoreprocesses(orthreads)arewaitingforaneventthatwilloccurinthefuture.FStarvationisasituationinwhichaprocessisdeniedaccesstoaresourcebecauseofthecompetitiveactivityofother,possiblyunrelated,processes.TWhileaprocessisblockedonasemaphore'squeue,itisengagedinbusywaiting.FMutualexclusioncanbeenforcedwithageneralsemaphorewhoseinitialvalueisgreaterthan1.FAprinterisanexampleofalogicalresource.FVersionsofOS/360arestillwidelyusedtoday.FWhenanexecutingprocessisstoppedbythescheduler,itissaidtobeblocked.FInterruptsareusedtoachieveatypicaltimesharingOS.T二、MultipleChoiceQuestionsForeachofthefollowingquestions,Thereisonlyonecorrectanswer.Whatisthepurposeofsystemcalls?a)Systemcallsallowuser-levelprocessestogainresourcesfromtheoperatingsystem.b)Systemcallsarethestandardinterfacebetweenauserprocessandakernelprocess.c)Systemcallsallowuser-levelprocessestorequestservicesoftheoperatingsystem.d)Thereisnorealpurposetosystemcalls.Threadsbelongingtothesameprocesssharethea)stack b)datasectionc)registerset d)threadIDInMany-to-Onethreadmodel,Whatwouldhappenifathreadinamultithreadedprocessmakesablockingsystemcall?a)theotherthreadsoftheprocesswouldcontinuetorunb)theentireprocesswouldgetblockedc)theblockingthreadwillgetkilledd)theblockingthreadwillnevergettorunagainWhichofthefollowingOperatingsystemsusespreemptivescheduling?a)MacOS8 b)Windows3.xc)Windows2000 d)DOS6.0Ameasureofthenumberofprocessescompletedpertimeunitiscalleda)throughput b)waitingtimec)responsetime d)CPUutilizationOneoftheproblemswithpriorityschedulingisa)aging b)starvationc)processdeath d)averagewaitingtimeInatime-sharingsystem,whichofthefollowingisthebestcriterionforCPUscheduling.a)MinimizeCPUutilization b)MaximizeCPUutilizationc)Maximizesystemthroughput d)Minimizeresponsetime.TheinitialvalueofsemaphoreSis2.ifthevalueis-1atpresent,howmanyprocessesareblockedonthissemaphore.a)1b)2c)3d)4Asystemisinadeadlock,ifitsresourceallocationgrapha)containsacycle b)doesn’tcontainacyclec)containsacycleandthereisjustoneinstanceofeveryresourced)hasatleastoneoutgoingedgefromanyoneoftheprocessnodesPreemptionofresourcescanbeenforcedtopreventoccurrenceofdeadlocks,butthiscan’tbeappliedtoalltheresourcetypes,aspreemptionmightleavetheresourceinanundeterminedstate.Whichofthefollowingresourcescan’thencebepreempted?a)CPUregisters b)memoryspacec)tapedrive d)alloftheaboveAsystemissaidtobe___________ifitcancontinuetofunctionevenwhenanodeornodesinthesystemfail.a)networked b)distributedc)realtime d)fault-tolerantWhichofthefollowingactivityneedsnospecialhardwaresupport?a)Processscheduling b)timermanagementc)memorymapping d)interruptsystemWhichofthefollowingstatementaboutprocessesisincorrect?a)Aprocessisdynamic.b)Aprocesshasalifetime.c)Aprocessisasetofinstructions.d)Multipleprocessesmayexecuteconcurrently.三、Considerthefollowingsetofprocesses:ProcessBurst-TimePriorityP1 15 4P2 3 8P3 7 5P4 5 2P5 1 6P6 2 6TheprocessesareassumedtohavearrivedintheorderP1,P2,P3,P4,P5,P6,allattime0.UseFCFS,SJF,RoundRobin(quantumis2),Priority(lownumbershavehighpriority).Foreachofthealgorithms:1DrawaGanttchart2.Whatistheaveragewaitingtimeforeachoftheschedulingalgorithms?3.Whatistheaverageturnaroundtimeforeachoftheschedulingalgorithms?Answer:FCFS: P1P2P3P4P5P6151825303133AWT=(0+15+18+25+30+31)/6=19.83ATT=(15+18+25+30+31+33)/6=25.33SJF:P5P6P2P4P3P1AWT=(18+3+11+6+0+1)/6=6.5ATT=(33+6+18+11+1+3)/6=12Round-Robin(quantum=2):P1P2P3P4P5P6P1P2P3P4P1P3P4P1P3P1AWT=(18+11+19+8+9)/6=13.83ATT=(33+14+26+23+9+11)/6=19.33Priority:P4P1P3P5P6P2AWT=(5+30+20+0+27+28)/6=18.33ATT=(20+33+27+5+28+30)/6=23.83Twoconcurrentprocesseshaveinput,computingandprintingactions,respectively.ThatissaidI1,C1,P1forthe1stprocess,andI2,C2,P2forthe2ndprocess.Theirprecedentialrelationshipisshowninthefigure,i.e.I2musthappenafterI1,C2musthappenafterC1andI2,etc.Pleasedescribethesynchronizationrelationshipoftwoprocessesbymeansofsemaphoresandrelatedwait/signaloperations.I1I1I2C1C2P1P2Semaphore:s1,s2,s3:=0;P1: P2: { { I1; wait(s1); signal(s1); I2 C1; wait(s2);signal(s2); C2 ;P1; wait(s3);signal(s3); P2;} }五、TherearethreecooperativeprocessesP1,P2,andP3.Theyreaddata,denotedasa、bandc,fromthesameinputdevice,asshowninfigurebelow.Theinputdeviceisanexclusiveaccessdevice.Thefirstdatum(a)mustbereadbyprocessP1,theseconddatum(b)isreadbyprocessP2,andthethirddatum(c)

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论