Chapter99.3Describethefollowingallocationalgorithms:a.Firstfitb.Bestfitc.WorstfitFirstfit:搜索可用内存列表,分配第一块足够大的Bestfit:搜索整个可用内存块,分配最小足够大的Worstfit:搜索整个可用内存块,分配最大足够大的9-cont.9.5Givenmemorypartitionsof100K,500K,200K,300K,and600K(inorder),howwouldeachoftheFirst-fit,Best-fit,andWorst-fitalgorithmsplaceprocessesof212K,417K,112K,and426K(inorder)?Whichalgorithmmakesthemostefficientuseofmemory?Firstfit212-500(288)417-600(183)112-288426-noneBestfit212-300417-500112-200426-600Worstfit212-600(388)417-500112-388426-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,430b.1,10c.2,500d.3,400e.4,112a.430600,219+430=649b.1014,2300+10=2310c.500100,illegald.400580,1327+400=1727e.11296,illegal9-cont.9.18IntheIBM/370,memoryprotectionisprovidedthroughtheuseofkeys.Akeyisa4-bitquantity.Each2Kblockofmemoryhasakey(thestoragekey)associatedwithit.TheCPUalsohasakey(theprotectionkey)associatedwithit.Astoreoperationisallowedonlyifbothkeysareequal,orifeitheriszero.Whichofthefollowingmemory-managementschemescouldbeusedsuccessfullywiththishardware?a.Baremachineb.Single-usersystemc.Multiprogrammingwithafixednumberofprocessesd.Multiprogrammingwithavariablenumberofprocessese.Pagingf.Segmentationa.Protectionnotnecessary,setsystemkeyto0.b.Setsystemkeyto0wheninsupervisormode.c.Regionsizesmustbefixedinincrementsof2kbytes,allocatekeywithmemoryblocks.d.Sameasabove.e.Framesizesmustbeinincrementsof2kbytes,allocatekeywithpages.f.Segmentsizesmustbeinincrementsof2kbytes,allocatekeywithsegments.Chapter1010.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.LRUreplacementb.FIFOreplacementc.Optimalreplacementd.Second-chancereplacementRankAlgorithmSufferfromBelady’sanomaly1Optimalno2LRUno3Second-chanceyes4FIFOyes10-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.LRUreplacementFIFOreplacementOptimalreplacementNumberofframesLRUFIFOOptimal12020202181815315161141014858107671077777Chapter1111.3Whydosomesystemskeeptrackofthetypeofafile,whileothersleaveittotheuserorsimplydonotimplementmultiplefiletypes?Whichsystemis“better?”Somesystemsallowdifferentfileoperationsbasedonthetypeofthefile(forinstance,anasciifilecanbereadasastreamwhileadatabasefilecanbereadviaanindextoablock).Othersystemsleavesuchinterpretationofafile’sdatatotheprocessandprovidenohelpinaccessingthedata.Themethodwhichis“better”dependsontheneedsoftheprocessesonthesystem,andthedemandstheusersplaceontheoperatingsystem.Ifasystemrunsmostlydatabaseapplications,itmaybemoreefficientfortheoperatingsystemtoimplementadatabase-typefileandprovideoperations,ratherthanmakingeachprogramimplementthesamething