版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、Module 10: Virtual MemoryBackground(背景)Demand Paging(请求页式)Performance of Demand Paging(请求页式的性能) Page Replacement(页置换)Replacement Algorithms(页置换算法)Allocation of Frames (页框的分配)Thrashing(颠簸)Other Considerations(其他考虑)Demand Segmenation(请求段式)Applied Operating System ConceptsBackgroundVirtual memory separ
2、ation of user logical memory from physical memory.(虚拟内存物理内存和用户逻辑内存的区分)局部性原理(principle of locality) 时间局部性,空间局部性 Only part of the program needs to be in memory for execution (只有部分运行的程序需要在内存中).Logical address space can therefore be much larger than physical address space(因此,逻辑地址空间能够比物理地址空间大).Need to al
3、low pages to be swapped in and out(必须允许页面能够被换入和换出).Virtual memory can be implemented via(虚拟内存能够通过以下手段来执行):Demand paging (请求页式)Demand segmentation(请求段式)Applied Operating System Concepts(1)虚拟存储器的基本概念1.虚拟存储器的引入 1)局部性原理 在一段时间内,程序的执行仅局限于某个部分;相应地,它所访问的存储空间也局限于某个区域内。那么程序为什么会出现局部性规律呢?原因可以归结为以下几点:程序在执行时,除了少部
4、分的转移和过程调用指令外,大多数仍是顺序执行的。子程序调用将会使程序的执行由一部分内存区域转至另一部分区域。但在大多数情况下,过程调用的深度都不超过5。程序中存在许多循环结构,循环体中的指令被多次执行。程序中还包括许多对数据结构的处理,如对连续的存储空间数组的访问,往往局限于很小的范围内。Applied Operating System Concepts局限性表现为: 时间局限性:如果程序中的某条指令一旦执行,则不久的将来该指令可能再次被执行;如果某个存储单元被访问,则不久以后该存储单元可能再次被访问。产生时间局限性的典型原因是在程序中存在着大量的循环操作。空间局限性:一旦程序访问了某个存储单
5、元,则在不久的将来,其附近的存储单元也最有可能被访问。 即程序在一段时间内所访问的地址,可能集中在一定的范围内,其典型原因是程序是顺序执行的。Applied Operating System ConceptsBackground 虚拟存储的基本原理 根据局部性原理,一个作业在运行之前,没有必要把全部作业装入内存,而仅将那些当前要运行的那部分页面或段,先装入内存便可启动运行,其余部分暂时留在磁盘上 程序在运行时如果它所要访问的页(段)已调入内存,便可继续执行下去;但如果程序所要访问的页(段)尚未调入内存(称为缺页或缺段),此时程序应利用OS所提供的请求调页(段)功能,将它们调入内存,以使进程能继
6、续执行下去。如果内存已满,无法再装入新的页(段),则还须再利用页(段)的置换功能,将内存中暂时不用的页(段)调出至磁盘上,腾出足够的内存空间后,再将所要访问的页(段)调入内存,使程序继续执行下去。这样,便可使一个大的用户程序在较小的内存空间中运行;也可使内存中同时装入更多的进程并发执行。从用户角度看,该系统所具有的内存容量,将比实际内存容量大得多,人们把这样的存储器称为虚拟存储器。Applied Operating System ConceptsBackground 引入虚拟存储技术的好处 可在较小的可用内存中执行较大的用户程序 可在内存中容纳更多程序并发执行 不必影响编程时的程序结构(与覆盖
7、技术比较) 提供给用户可用的虚拟内存空间通常大于物理内存(real memory)Applied Operating System ConceptsBackground 虚拟存储技术的特征离散性:指在内存分配时采用离散的分配方式,它是虚拟存储器的最基本的特征。多次性:指一个作业被分成多次调入内存运行,即在作业运行时没有必要将其全部装入,只须将当前要运行的那部分程序和数据装入内存即可。多次性是虚拟存储器最重要的特征。对换性:指允许在作业的运行过程中在内存和外存的对换区之间换进、换出。虚拟性:指能够从逻辑上扩充内存容量,使用户所看到的内存容量远大于实际内存容量。Applied Operating
8、System ConceptsBackgroundpage0.Page nVirtual memoryMemorymapPhysicalmemoryApplied Operating System Concepts虚拟存储器实现方式1)请求分页系统: 在分页系统的基础上,增加了请求调页功能和页面置换功能所形成的页式虚拟存储系统。它允许只装入若干页(而非全部程序)的用户程序和数据,就可以启动运行,以后再通过调页功能和页面置换功能,陆续把将要运行的页面调入内存,同时把暂不运行的页面置换到外存上,置换时以页面为单位。2)请求分段系统: 在分段系统的基础上,增加了请求调段和分段置换功能所形成的段式虚拟
9、存储系统。它允许只装入若干段(而非全部段)的用户程序和数据,就可以启动运行,以后再通过调段功能和置换功能将不运行的段调出,同时调入将要运行的段,置换以段为单位。3)请求段页式系统:它是在段页式系统的基础上,增加了请求调页和页面置换功能所形成的段页式虚拟存储系统。Applied Operating System ConceptsDemand PagingBring a page into memory only when it is needed(只有在一个页需要的时候才把它换入内存).Less I/O needed(需要很少的I/O)Less memory needed (需要很少的内存)Fa
10、ster response(快速响应)More users(多用户)Page is needed (需要页) reference to it(查阅此页)invalid reference(无效的访问) abort(中止)not-in-memory(不在内存) bring to memory(换入内存)取页-将哪部分装入内存置页-将调入的页放在什么地方淘汰-内存不足时,将哪些页换出内存。Applied Operating System Concepts请求分页存储管理方式1.请求分页中的硬件支持 它是在纯分页系统的基础上,增加了请求调页功能、页面置换功能所形成的页式虚拟存储系统,它是目前常用的一
11、种虚拟存储器的方式。1)请求分页的页表机制 它是在纯分页的页表机制上形成的,由于只将应用程序的一部分调入内存,还有一部分仍在磁盘上,故需在页表中再增加若干项,供程序(数据)在换进、换出时参考。在请求分页系统中的每个页表项如图所示。 页号 物理块号 状态位P 访问字段A 修改位M 外存地址Applied Operating System Concepts其中各字段说明如下:状态位(存在位P):用于指示该页是否已调入内存,供程序访问时参考。访问字段A:用于记录本页在一段时间内被访问的次数,或最近已有多长时间未被访问,提供给置换算法选择换出页面时参考。修改位M:表示该页在调入内存后是否被修改过。由于
12、内存中的每一页都在外存上保留一份副本,因此,若未被修改,在置换该页时就不需将该页写回到外存上,以减少系统的开销和启动磁盘的次数;若已被修改,则必须将该页重写到外存上,以保证外存中所保留的始终是最新副本。外存地址:用于指出该页在外存上的地址,通常是物理块号,供调入该页时使用。Applied Operating System Concepts请求分页中的硬件支持2)缺页中断机构 在请求分页系统中,每当所要访问的页面不在内存时,便要产生一缺页中断,请求OS将所缺页调入内存。与一般中断的主要区别在于:缺页中断在指令执行期间产生和处理中断信号,而一般中断在一条指令执行完后检查和处理中断信号。缺页中断返回
13、到该指令的开始重新执行该指令,而一般中断返回到该指令的下一条指令执行。一条指令在执行期间,可能产生多次缺页中断。Applied Operating System Concepts请求分页中的硬件支持3)地址变换机构 请求分页系统中的地址变换机构,是在分页系统的地址变换机构的基础上,再为实现虚拟存储器而增加了某些功能所形成的,如产生和处理缺页中断,以及从内存中换出一页的功能等等,下图给出了请求分页系统的地址变换过程。Applied Operating System Concepts 缺页中断处理 是 否 否 是 是 否 产生缺页中 否 是 断请求调页 是开始(程序请求访问一页)越界中断CPU检索
14、快表页表项是否在快表中?访问页表页是否在内存中?修改快表修改访问位和修改位形成物理地址 地址变换结束保留CPU现场 从外存中找到缺页 页号页表长度? 内存满否?选择一页换出 该页是否被修改? 将该页写回外存 将一页从外存换入内存 修改页表 CPU从外存读缺页 启动I/O硬件 Applied Operating System ConceptsValid-Invalid BitWith each page table entry a validinvalid bit is associated(1 in-memory, 0 not-in-memory)(在每一个页表的表项有一个有效- 无效位相关联
15、,1表示在内存,0表示不内存)Initially validinvalid but is set to 0 on all entries(在所有的表项,这个位被初始化为0).Example of a page table snapshot(一个页表映象的例子).During address translation, if validinvalid bit in page table entry is 0(在地址转换中,如果页表表项位的值是0) page fault(缺页).1111000Frame #valid-invalid bitpage tableApplied Operating Sy
16、stem ConceptsPage FaultIf there is ever a reference to a page, first reference will trap to OS(如果有对一个页的访问,第一个访问要陷入OS) page fault(缺页)OS looks at another table to decide(OS查看另一个表来决定):Invalid reference(无效引用) abort(终止).Just not in memory(仅仅不在内存).Get empty frame(得到空的页框).Swap page into frame(把页换入页框).Reset
17、 tables, validation bit = 1(重新设置页表,把位设为1).Restart instruction(重启指令): Least Recently Used (最近未使用)block move(块移动)auto increment/decrement location(区域自动增长/缩减)Applied Operating System ConceptsSteps in handling a page faultLoad M iFree frameOperatingsystemPagetable1reference6 Restart instruction5 Reset p
18、age table3 page is on backing store2 trapPhysical memory4 bring in missing pageApplied Operating System ConceptsWhat happens if there is no free frame?1.we check an internal table(usually kept with the process control block) for this process,to determine whether the reference was a valid or invalid
19、memory access.2.if the reference was invalid, we terminate the process. If it was valid,but we have not yet brought in that page,we now age it in.3.we find a free frame(by taking one from the free-frame list,for example)4.we schedule a disk operation to read the desired page into the newly allocated
20、 frame.5 when the disk read is complete, we modify the internal table kept with the process and the page table to indicate that the page is now in memory6. We restart the instruction that was interrupted by the illegal address trap.the process can now access the page as though it had always been in
21、memoryApplied Operating System ConceptsWhat happens if there is no free frame?Page replacement find some page in memory, but not really in use, swap it out(页置换找到内存中并没有使用的一些页,换出).Algorithm(算法)Performance(性能) want an algorithm which will result in minimum number of page faults(找出一个导致最小缺页数的算法).Same pag
22、e may be brought into memory several times(同一个页可能会被装入内存多次).Applied Operating System Concepts调入策略、分配策略和清除策略 调入策略 (fetch policy)(1) 请求调页(demand paging)(2) 预调页(prepaging) 分配策略 (assignment policy)清除策略(cleaning policy) 请求清除(demand cleaning) 预清除(precleaning) Applied Operating System Concepts页面调入策略 为能使进程运行
23、,必须事先将一部分要执行的程序和数据调入内存。1)调入页面的时机 预调页策略: 是一种主动的缺页调入策略,即将那些预计在不久的将来会被访问的程序或数据所在的页面,预先调入内存。由于预测的准确率不高(50%),所以这种策略主要用于进程的首次调入。有的系统将预调页策略用于请求调页,Applied Operating System Concepts页面调入策略请求调页策略: 是指当进程在运行中发生缺页时,就立即提出请求,由系统将缺页调入内存。目前的虚拟存储器中,大多采用此策略。但这种策略在调页时须花费较大的系统开销,如需频繁启动磁盘I/O。Applied Operating System Conce
24、pts页面调入策略2)从何处调入页面 在虚拟存储系统中,外存(硬盘)常常被分成两部分;文件区(用于存放文件)和对换区(用于存放对换页面)。通常,对换区(连续分配)的磁盘I/O速度比文件区(离散分配)要高。 每当进程发出缺页请求时,系统应从何处将缺页调入内存呢?在UNIX系统中,对于从未运行过的页面,都应从硬盘文件区调入;对于曾经运行过而又被换出的页面,可以从对换区调入;对于共享页面,该页面可能已由其它进程调入内存,此时就无须再从对换区调入。Applied Operating System ConceptsPerformance of Demand PagingA page fault caus
25、e the following sequence to occur: 1. Trap to the operating system 2.Save the user registers and process state 3.Determine that the interrupt was a page fault 4. Check that the page reference was legal and determine the location of the page on the disk 5.Issue a read from the disk to a free frame: a
26、.Wait in a queue for this device until the read request is serviced. b. Wait for the devices seek and/or latency time c. Begin the transfer of the page to a free frame 6. While waiting,allocate the cpu to some user(cpu scheduling operation) 7.Interrupt from the disk(I/O completed) 8.Save the registe
27、rs and process state for the other user(if step 6 executed) 9.Determine that the interrupt was from the disk10. Correct the page table and other tables to show that the desired page is now in memory11.Wait for the cpu to be allocated to this process again12 Restore the user registers,process state,a
28、nd new page table,then resume the interrupted instruction.Applied Operating System Concepts 缺页率假定作业Ji共有m页,系统分配给它的主存块为n块,这里mn。开始时,主存没有装入任何一页的信息。如果作业Ji在运行中成功访问的次数为S,不成功的访问次数为F(产生缺页中断的次数),则作业执行过程中总的访问次数为A.A=S(成功访问的次数)+F(不成功的访问次数)作业Ji执行过程中的缺页率f=F/A。 Applied Operating System ConceptsPerformance of Demand
29、 PagingPage Fault Rate 0 p 1.0(缺页率0 p 1.0)if p = 0 no page faults (如果p = 0 ,没有缺页)if p = 1, every reference is a fault(每次访问都缺页)Effective Access Time (EAT)(有效存取时间)EAT = (1 p) x memory access+ p (page fault overhead+ swap page out + swap page in+ restart overhead)Applied Operating System ConceptsDemand
30、 Paging ExampleMemory access time = 1 microsecond (存取内存的时间)50% of the time the page that is being replaced has been modified and therefore needs to be swapped out( 50%的时间,所置换的页被修改,因此需要被换出).Swap Page Time = 10 msec (交换页的时间)EAT = (1 p) x 1 + p (10) = 1 + 9P (in msec)Applied Operating System ConceptsPa
31、ge ReplacementPrevent over-allocation of memory by modifying fault service routine to include page replacement(通过修改缺页服务例程,来包含页置换,防止分配过多).Use modify (dirty) bit to reduce overhead of page transfers only modified pages are written to disk(修改(脏)位来防止页面转移过多只有被修改的页面才写入磁盘).Page replacement completes separa
32、tion between logical memory and physical memory large virtual memory can be provided on a smaller physical memory(页置换完善了逻辑内存和物理内存的划分在一个较小的物理内存基础之上可以提供一个大的虚拟内存.Applied Operating System ConceptsReplacement AlgorithmsWant lowest fault rate(需要一个最小的缺页率).Evaluate algorithm by running it on a particular st
33、ring of memory references (reference string) and computing the number of page faults on that string(通过运行一个内存访问的特殊序列(访问序列),计算这个序列的缺页次数).In all our examples, the reference string is (在所有的例子中,访问序列是)1, 2, 3, 4, 1, 2, 5, 1, 2, 3, 4, 5.Applied Operating System ConceptsReplacement Algorithms1.最佳算法(OPT, opt
34、imal)2.最近最久未使用算法(LRU,Least Recently Used)3.先进先出算法(FIFO) Belady现象4.轮转算法(clock) 最近未使用算法(NRU, Not Recently Used)5.最不常用算法(LFU, Least Frequently Used)Applied Operating System Concepts 先进先出(FIFO)置换算法Applied Operating System Concepts 先进先出(FIFO)置换算法Applied Operating System ConceptsFirst-In-First-Out (FIFO)
35、AlgorithmReference string: 1, 2, 3, 4, 1, 2, 5, 1, 2, 3, 4, 53 frames (3 pages can be in memory at a time per process)4 framesFIFO Replacement Beladys Anomaly(FIFO算法可能会产生Belady异常)more frames less page faults(页就是更多的页框相反会产生更多的缺页)1231234125349 page faults1231235124510 page faults443Applied Operating Sy
36、stem Concepts页面置换算法 .最佳(Optimal)置换算法 它是一种理想化的算法,性能最好,但在实际上难于实现。即选择那些永不使用的,或者是在最长时间内不再被访问的页面置换出去。但是要确定哪一个页面是未来最长时间内不再被访问的,目前来说是很难估计的,所以该算法通常用来评价其它算法。Applied Operating System Concepts页面置换算法例:假定系统为某进程分配了三个物理块,并考虑有以下的页面号引用串:7,0,l,2,0,3,0,4,2,3,0,3,2,l,2,0,l,7,0,1。如下图所示,进程运行时先将7,0,1三个页面装入内存。当进程访问页面2时,产生缺
37、页中断,此时OS根据最佳置换算法,页面7将在第18次才被访问,是三页中将最久不被访问的页面,所以被淘汰。接着访问页面0时,发现已在内存中,而不会产生缺页中断,以此类推。从图可以看出,采用最佳置换算法,只发生了6次页面置换。Applied Operating System Concepts最佳(Optimal)置换算法发生了6次面置换,9次缺页中断。Applied Operating System ConceptsOptimal AlgorithmReplace page that will not be used for longest period of time(被置换的页将是之后最长时间
38、不被使用的页).4 frames example 1, 2, 3, 4, 1, 2, 5, 1, 2, 3, 4, 5How do you know this?(怎样知道的)Used for measuring how well your algorithm performs(用来衡量你的算法的效率).12346 page faults45Applied Operating System Concepts 最近最久未使用置换算法Applied Operating System ConceptsLeast Recently Used (LRU) AlgorithmReference string
39、: 1, 2, 3, 4, 1, 2, 5, 1, 2, 3, 4, 5Counter implementation(计数器的实现)Every page entry has a counter; every time page is referenced through this entry, copy the clock into the counter(每一个页表项 有一个计数器,每次页通过这个表项被访问,把记录拷贝到计数器中).When a page needs to be changed, look at the counters to determine which are to c
40、hange(当一个页需要改变是,查看计数器来觉得改变哪一个页0.)12354435Applied Operating System ConceptsLRU Algorithm (Cont.)Stack implementation keep a stack of page numbers in a double link form(栈实现在一个双链表中保留一个记录页数目的栈):Page referenced(被访问的页):move it to the top(移到栈顶)requires 6 pointers to be changed(需要改变6个指针)No search for replac
41、ement(没有为置换进行查找)Applied Operating System Concepts LRU近似算法这种算法,只要在存储分块表(或页表)中设一个“引用位”,当存储分块表中的某一页被访问时,该位由硬件自动置1,并由页面管理软件周期性把所有引用位置0。这样,在一个时间周期T内,某些被访问过的页面其引用位为1,而未被访问过的页面其引用位为0。因此,可根据引用位的状态来判别各页面最近的使用情况。当需要置换一页面时,选择其引用位为0的页,如图所示的算法 。图是这种近似算法的一个例子。 Applied Operating System Concepts LRU近似算法 Applied Ope
42、rating System Concepts LRU近似算法举例Applied Operating System ConceptsLRU Approximation AlgorithmsReference bit(访问位)With each page associate a bit, initially -= 0(每个页都与一个位相关联,初始值位0)When page is referenced bit set to 1(当页是访问位是设位1).Replace the one which is 0 (if one exists). We do not know the order, howev
43、er(,如果存在的话置换位为0的页。然而我们并不知道这个置换顺序).Second chance(二次机会)Need reference bit.(需要访问位)Clock replacement.(时钟置换)If page to be replaced (in clock order) has reference bit = 1. Then(如果将要(以顺时针)交换的访问位是1,则):set reference bit 0(把访问位设位0).leave page in memory(把页留在内存中).replace next page (in clock order), subject to s
44、ame rules(以同样的规则,替换下一个页).Applied Operating System ConceptsCounting AlgorithmsKeep a counter of the number of references that have been made to each page.(用一个计数器记录对每一个页的访问次数。)LFU Algorithm: replaces page with smallest count(以最小的计数置换一个页).MFU Algorithm: based on the argument that the page with the smal
45、lest count was probably just brought in and has yet to be used(以下面的观点为基础,最小计数的页也许刚刚被换入和使用).Applied Operating System ConceptsAllocation of FramesEach process needs minimum number of pages(每个进程所需要的最少的页的数目).Example: IBM 370 6 pages to handle SS MOVE instruction:instruction is 6 bytes, might span 2 page
46、s.2 pages to handle from.2 pages to handle to.Two major allocation schemes(两个主要的分配策略).fixed allocation(固定分配)priority allocation(优先分配)Applied Operating System Concepts页面分配1)最少物理块数 在为进程分配物理块时,首先应该考虑的问题是:能保证进程能正常运行所需的最少物理块数(称为最小物理块数)。若系统为某进程所分配的物理块数少于此值时,进程将无法运行,这取决于指令的格式、功能和寻址方式。Applied Operating Syst
47、em Concepts页面分配2)页面的分配和置换策略 在请求分页系统中,可采取两种分配策略固定和可变分配策略。在进行置换时,也可采取两种策略全局置换和局部置换。于是可组合成以下三种策略:固定分配局部置换策略:它基于进程的类型(交互型或批处理型等),或根据程序员、系统管理员的建议,为每个进程分配一固定页数的内存空间,在整个运行期间都不再改变。如果进程在运行中发现缺页,则只能从该进程在内存的固定页面中选出一页换出,然后再调入另一页,保证分配给该进程的内存空间不变。Applied Operating System Concepts页面分配可变分配全局置换策略:系统为每个进程分配一定数目的物理块,而
48、OS本身也保持一个空闲物理块队列。当某进程发现缺页时,由系统从空闲物理块队列中,取出一物理块分配给该进程,并将欲调入的缺页装入其中。当空闲物理块队列中的物理块用完时,OS才能从内存中选择一页调出,该页可能是系统中任一进程的页。Applied Operating System Concepts页面分配可变分配局部置换:根据进程的类型或程序员的要求,为每个进程分配一定数目的内存空间,并且在进程运行期间可根据情况适当增加或减少所分配的物理块数;但当某进程发生缺页时,只允许从该进程在内存的页面中选出一页换出,而不影响其它进程的运行。Applied Operating System Concepts页面
49、分配 页面分配算法在采用固定分配策略时,可采用以下几种物理块分配方法:平均分配算法:将系统中所有可供分配的物理块,平均分配给各个进程。按比例分配算法:这是根据进程的大小按比例分配物理块。Applied Operating System Concepts页面分配 页面分配算法考虑优先权的分配算法:该方法是把内存中可供分配的所有物理块分成两部分:一部分按比例分配给各进程;另一部分则根据各进程的优先权,适当地增加其相应份额后,分配给各进程。Applied Operating System ConceptsFixed AllocationEqual allocation(平均分配) e.g., if
50、100 frames and 5 processes, give each 20 pages(例:如果有100个页框,和5个进程,则每个进程分给20个页).Proportional allocation(按比率分配) Allocate according to the size of process(根据每个进程的大小来分配).Applied Operating System ConceptsPriority AllocationUse a proportional allocation scheme using priorities rather than size(根据优先级而不是大小来使
51、用比率分配策略).If process Pi generates a page fault,(如果进程Pi产生一个缺页)select for replacement one of its frames(选择替换其中的一个页框).select for replacement a frame from a process with lower priority number(从一个较低优先级的进程中选择一个页面来替换).Applied Operating System ConceptsGlobal vs. Local AllocationGlobal replacement(全局替换) proce
52、ss selects a replacement frame from the set of all frames; one process can take a frame from another(进程在所有的页中选择一个替换页面;一个进程可以从另一个进程中获得页面).Local replacement (局部替换) each process selects from only its own set of allocated frames(每个进程只从属于它自己的页中选择).Applied Operating System ConceptsThrashingIf a process do
53、es not have “enough” pages, the fault rate is very high. This leads to(如果一个进程没有足够的页,那么缺页率将很高,这将导致):low CPU utilization(CPU利用率低下).operating system thinks that it needs to increase the degree of multiprogramming(操作系统认为需要增加多道程序设计的道数).another process added to the system(系统中将加入一个新的进程).Thrashing(颠簸) a pro
54、cess is busy swapping pages in and out(一个进程的页面经常换入换出).Applied Operating System ConceptsThrashing DiagramWhy does paging work?(为什么分页工作)Locality model(位置模式)Process migrates from one locality to another(进程从一个位置移到另一个位置).Localities may overlap(位置可能重叠).Why does thrashing occur?(为什么颠簸会发生) size of locality
55、total memory sizeApplied Operating System ConceptsWorking-Set Model working-set window a fixed number of page references Example: 10,000 instructionWSSi (working set of Process Pi) =total number of pages referenced in the most recent (varies in time)if too small will not encompass entire locality.if
56、 too large will encompass several localities.if = will encompass entire program.D = WSSi total demand frames if D m ThrashingPolicy if D m, then suspend one of the processes.Applied Operating System ConceptsFault Frequency SchemeEstablish “acceptable” fault rate(设置可接受的缺页率).If actual rate too low, pr
57、ocess loses frame(如果缺页率太低,回收一些进程的页框).If actual rate too high, process gains frame(如果缺页率太高,就分给进程一些页框).Applied Operating System ConceptsOther ConsiderationsPrepaging (预先调页)Page size selection(页面尺寸选择)Fragmentation(碎片)table size (表大小)I/O overhead(I/O开销)Locality(位置)Applied Operating System ConceptsOther
58、Consideration (Cont.)Program structure(程序结构)Array A1024, 1024 of integerEach row is stored in one pageOne frame Program 1 for j := 1 to 1024 dofor i := 1 to 1024 doAi,j := 0;1024 x 1024 page faults Program 2 for i := 1 to 1024 dofor j := 1 to 1024 doAi,j := 0;1024 page faultsI/O interlock and addres
59、sing(I/O连接和地址)Applied Operating System ConceptsDemand SegmentationUsed when insufficient hardware to implement demand paging(当请页的硬件不充足时使用).OS/2 allocates memory in segments, which it keeps track of through segment descriptors(操作系统以段来分配内存,它通过段描述符来进行跟踪)Segment descriptor contains a valid bit to indica
60、te whether the segment is currently in memory(段描述符有一个有效位来说明段是否以在内存).If segment is in main memory, access continues(如果段已在主存中,继续存取),If not in memory, segment fault(如果不在内存中,缺段中断).Applied Operating System Concepts请求分段存储管理方式 请求分段系统在分段系统的基础上实现的虚拟存储器,是以分段为单位进行换入、换出的。在程序运行之前只要先调入若干个分段(不必调入所有的分段),便可启动运行。当所访问
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 某塑料厂注塑成型工艺细则
- 老年专科考试题及答案
- 物料进出洁净区管理规程
- 机构研究报告-意大利线上购物用户分析报告:Euronics
- 2.3期望最大化算法推导
- AI技术助力传统风筝文化数字化保护
- 安徽省2026八年级数学下册第17章一元二次方程及其应用17.2一元二次方程的解法3公式法课件新版沪科版
- 2026年内蒙古自治区中考英语试题(学生卷)
- 广东省韶关市仁化县2023-2024学年九年级上学期语文期中考试试卷(含答案)
- 2026年企业反恐安全防范试题及答案
- ISO 9001(DIS)-2026《质量管理体系要求》中英文标准对照版(2025年9月)
- DB50∕T 10013-2025 川渝省际毗邻地区公交运营服务规范
- 环保应急知识培训课件
- 宫颈癌早期诊断筛查课件
- 电气工作票技术规范
- 再生水利用项目可行性研究报告立项
- 体育社会组织建设与管理
- T-CBIA 010-2024 营养素饮料标准
- 2024年广东省普通高中学业水平合格性地理试卷(1月份)
- 思念混声合唱简谱
- 投资回报模型构建及应用
评论
0/150
提交评论