操作系统概念第六版作业解答3

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

Chapter99.3Describethefollowingallocationalgorithms:a.Firstfitb.Bestfitc.WorstfitFirstfit:搜索可用内存列表,分配第一块足够大的Bestfit:搜索整个可用内存块,分配最小足够大的Worstfit:搜索整个可用内存块,分配最大足够大的9-cont.9.5Givenmemorypartitionsof100K,500K,200K,300K,and600K(inorder),howwouldeachoftheFirst-fit,Best-fit,andWorst-fitalgorithmsplaceprocessesof212K,417K,112K,and426K(inorder)?Whichalgorithmmakesthemostefficientuseofmemory?Firstfit212-500(288)417-600(183)112-288426-noneBestfit212-300417-500112-200426-600Worstfit212-600(388)417-500112-388426-none9-cont.9.10Considerapagingsystemwiththepagetablestoredinmemory.a.Ifamemoryreferencetakes200nanoseconds,howlongdoesapagedmemoryreferencetake?b.Ifweaddassociativeregisters,and75percentofallpage-tablereferencesarefoundintheassociativeregisters,whatistheeffectivememoryreferencetime?(Assumethatfindingapage-tableentryintheassociativeregisterstakeszerotime,iftheentryisthere.)a.400,200(pagetable)+200(accessword)b.250,75%*200+25%*(200+200)9-cont.9.16Considerthefollowingsegmenttable:Whatarethephysicaladdressesforthefollowinglogicaladdresses?a.0,430b.1,10c.2,500d.3,400e.4,112a.430600,219+430=649b.1014,2300+10=2310c.500100,illegald.400580,1327+400=1727e.11296,illegal9-cont.9.18IntheIBM/370,memoryprotectionisprovidedthroughtheuseofkeys.Akeyisa4-bitquantity.Each2Kblockofmemoryhasakey(thestoragekey)associatedwithit.TheCPUalsohasakey(theprotectionkey)associatedwithit.Astoreoperationisallowedonlyifbothkeysareequal,orifeitheriszero.Whichofthefollowingmemory-managementschemescouldbeusedsuccessfullywiththishardware?a.Baremachineb.Single-usersystemc.Multiprogrammingwithafixednumberofprocessesd.Multiprogrammingwithavariablenumberofprocessese.Pagingf.Segmentationa.Protectionnotnecessary,setsystemkeyto0.b.Setsystemkeyto0wheninsupervisormode.c.Regionsizesmustbefixedinincrementsof2kbytes,allocatekeywithmemoryblocks.d.Sameasabove.e.Framesizesmustbeinincrementsof2kbytes,allocatekeywithpages.f.Segmentsizesmustbeinincrementsof2kbytes,allocatekeywithsegments.Chapter1010.1Underwhatcircumstancesdopagefaultsoccur?Describetheactionstakenbytheoperatingsystemwhenapagefaultoccurs.Apagefaultoccurswhenanaccesstoapagethathasnotbeenbroughtintomainmemorytakesplace.Theoperatingsystemverifiesthememoryaccess,abortingtheprogramifitisinvalid.Ifitisvalid,afreeframeislocatedandI/Oisrequestedtoreadtheneededpageintothefreeframe.UponcompletionofI/O,theprocesstableandpagetableareupdatedandtheinstructionisrestarted.10-cont.10.6Considerthefollowingpage-replacementalgorithms.Rankthesealgorithmsonafivepointscalefrom“bad”to“perfect”accordingtotheirpage-faultrate.SeparatethosealgorithmsthatsufferfromBelady’sanomalyfromthosethatdonot.a.LRUreplacementb.FIFOreplacementc.Optimalreplacementd.Second-chancereplacementRankAlgorithmSufferfromBelady’sanomaly1Optimalno2LRUno3Second-chanceyes4FIFOyes10-cont.10.9Considerademand-pagingsystemwiththefollowingtime-measuredutilizations:CPUutilization20%Pagingdisk97.7%OtherI/Odevices5%Which(ifany)ofthefollowingwill(probably)improveCPUutilization?Explainyouranswer.a.InstallafasterCPU.b.Installabiggerpagingdisk.c.Increasethedegreeofmultiprogramming.d.Decreasethedegreeofmultiprogramming.e.Installmoremainmemory.f.Installafasterharddiskormultiplecontrollerswithmultipleharddisks.g.Addprepagingtothepagefetchalgorithms.h.Increasethepagesize.10-cont.10.10Considerthetwo-dimensionalarrayA:intA[][]=newint[100][100];whereA[0][0]isatlocation200,inapagedsystemwithpagesofsize200.Asmallprocessisinpage0(locations0to199)formanipulatingthematrix;thus,everyinstructionfetchwillbefrompage0.Forthreepageframes,howmanypagefaultsaregeneratedbythefollowingarray-initializationloops,usingLRUreplacement,andassumingpageframe1hastheprocessinit,andtheothertwoareinitiallyempty:a.for(intj=0;j100;j++)for(inti=0;i100;i++)A[i][j]=0;b.for(inti=0;i100;i++)for(intj=0;j100;j++)A[i][j]=0;a.100x50b.5010-cont.10.11Considerthefollowingpagereferencestring:1,2,3,4,2,1,5,6,2,1,2,3,7,6,3,2,1,2,3,6.Howmanypagefaultswouldoccurforthefollowingreplacementalgorithms,assumingone,two,three,four,five,six,orsevenframes?Rememberallframesareinitiallyempty,soyourfirstuniquepageswillallcostonefaulteach.LRUreplacementFIFOreplacementOptimalreplacementNumberofframesLRUFIFOOptimal12020202181815315161141014858107671077777Chapter1111.3Whydosomesystemskeeptrackofthetypeofafile,whileothersleaveittotheuserorsimplydonotimplementmultiplefiletypes?Whichsystemis“better?”Somesystemsallowdifferentfileoperationsbasedonthetypeofthefile(forinstance,anasciifilecanbereadasastreamwhileadatabasefilecanbereadviaanindextoablock).Othersystemsleavesuchinterpretationofafile’sdatatotheprocessandprovidenohelpinaccessingthedata.Themethodwhichis“better”dependsontheneedsoftheprocessesonthesystem,andthedemandstheusersplaceontheoperatingsystem.Ifasystemrunsmostlydatabaseapplications,itmaybemoreefficientfortheoperatingsystemtoimplementadatabase-typefileandprovideoperations,ratherthanmakingeachprogramimplementthesamething

1 / 24
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功