欢迎来到天天文库
浏览记录
ID:34430813
大小:377.46 KB
页数:84页
时间:2019-03-06
《操作系统1new》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、Chapter10VirtualMemoryMaincontent:1.Background2.DemandPaging3.ProcessCreation4.PageReplacement5.AllocationofFrames6.Thrashing1.Background(1)introduceSomeinstances:Programsoftenhavecodetohandleunusualerrorconditions.Arrays,lists,andtablesareoftenallocatedmorememorythantheyactuallyneed.Cer
2、tainoptionsandfeaturesofaprogrammaybeusedrarely.Benefitsofpartiallyinmemory:Aprogramwouldnolongerbeconstrainedbytheamountofphysicalmemoryavailable.Moreprogramscouldberunatthesametime.Useprogramwouldrunfaster.(2)VirtualmemorySpecification:separationofuserlogicalmemoryfromphysicalmemory..C
3、haracters:Onlypartoftheprogramneedstobeinmemoryforexecution.Logicaladdressspacecanthereforebemuchlargerthanphysicaladdressspace.Allowsaddressspacestobesharedbyseveralprocesses.Allowsformoreefficientprocesscreation.VirtualMemoryThatisLargerThanPhysicalMemory:(3)implementedDemandpagingDema
4、ndsegmentation2.DemandPaging(1)AboutDemandPagingspecification:Ademandpagingsystemissimilartoapagingsystemwithswapping.Processesresideonsecondarymemory.Bringapageintomemoryonlywhenitisneeded.Ratherthanswappingtheentireprocessintomemory,weusealazyswapper.Lazyswapper:Alazyswapperneverswapsa
5、pageintomemoryunlessthatpagewillbeneeded.example:(2)BasicmethodValid-InvalidBit:Witheachpagetableentryavalid–invalidbitisassociated(1⇒in-memory,0⇒not-in-memory).Initiallyvalid–invalidbutissetto0onallentries.example:PageFault:Iftheprocesstriestoaccessapagethatwasnotbroughtintomemory,acces
6、stoapagemarkedinvalidcauseatraptoOS⇒pagefault.HowtohandlePageFault:OSlooksatanothertabletodecide:Invalidreference⇒abort.Justnotinmemory⇒pageitin.Getemptyframe.Swappageintoframe.Resettables,validationbit=1.RestartinstructionStepsinHandlingaPageFault:Whathappensifthereisnofreeframe?Pagerep
7、lacement–findsomepageinmemory,butnotreallyinuse,swapitout.Problem:Samepagemaybebroughtintomemoryseveraltimes.Howtorestartanyinstructionafterapagefault:Apagefaultcouldoccuratanymemoryreference.Ifthepagefaultoccursontheinstructionfetch,wecanrestartbyfetchingtheinstructionag
此文档下载收益归作者所有