资源描述:
《8虚拟存储器.ppt》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、Chapter8:VirtualMemory基本概念局部性原理定义请求分页存储管理方式MMU支持页面分配调入策略页面置换算法性能分析抖动Chapter8:VirtualMemory请求分段存储管理Intel80386存储管理方式Background局部性原理在某个时间间隔内,程序的执行时访问的地址空间局限在某个范围定义把作业的一部分装入内存便可运行的存储器系统具请求调入功能和置换功能,能在逻辑上对内存容量进行扩充的存储器系统Background虚拟存储器实现方式请求分页请求分段虚拟存储器特征离散性多次性对换性虚拟性DemandPagingBr
2、ingapageintomemoryonlywhenitisneeded.LessI/OneededLessmemoryneededFasterresponseMoreusersDemandPaging硬件支持(MMU)页表支持页号物理块号状态位访问字段修改位外存地址缺页中断机构地址变换机构地址变换过程硬件操作软件操作页面分配最小物理块数页面分配和置换策略固定分配局部置换可变分配全局置换可变分配局部置换分配算法平均分配按比例分配考虑优先权的分配算法页面调入策略何时调入页面预调页策略请求调页策略从何处调入页面交换区文件区混合页面置换算法最佳置换
3、算法先进先出置换算法LRU置换算法Clock置换算法最少使用置换算法页面缓冲算法Page-ReplacementAlgorithmsWantlowestpage-faultrate.Evaluatealgorithmbyrunningitonaparticularstringofmemoryreferences(referencestring)andcomputingthenumberofpagefaultsonthatstring.Inallourexamples,thereferencestringis1,2,3,4,1,2,5,1,2,
4、3,4,5.First-In-First-Out(FIFO)AlgorithmReferencestring:1,2,3,4,1,2,5,1,2,3,4,53frames(3pagescanbeinmemoryatatimeperprocess)4framesFIFOReplacement–Belady’sAnomalymoreframeslesspagefaults1231234125349pagefaults10pagefaults12312351245443OptimalAlgorithmReplacepagethatwillnotb
5、eusedforlongestperiodoftime.4framesexample6pagefaults123445OptimalAlgorithm1,2,3,4,1,2,5,1,2,3,4,5Howdoyouknowthis?Usedformeasuringhowwellyouralgorithmperforms.6pagefaults123445LeastRecentlyUsed(LRU)AlgorithmReferencestring:1,2,3,4,1,2,5,1,2,3,4,512354435LeastRecentlyUsed(L
6、RU)AlgorithmCounterimplementationEverypageentryhasacounter;everytimepageisreferencedthroughthisentry,copytheclockintothecounter.Whenapageneedstobechanged,lookatthecounterstodeterminewhicharetochange.LRUAlgorithm(Cont.)Stackimplementation–keepastackofpagenumbersinadoublelink
7、form:Pagereferenced:moveittothetoprequires6pointerstobechangedNosearchforreplacementLRUApproximationAlgorithmsReferencebitWitheachpageassociateabit,initially-=0Whenpageisreferencedbitsetto1.Replacetheonewhichis0(ifoneexists).Wedonotknowtheorder,however.LRUApproximationAlgor
8、ithmsSecondchanceNeedreferencebit.Clockreplacement.Ifpagetobereplaced(inclockorder