[2018年最新整理]OS008-Memory.ppt

[2018年最新整理]OS008-Memory

Segmentation Memory Protection 段式内存保护 把内存分成几段,每段分别划给一个实体(操作系统代码、进程1、进程2、…) 基址限长寄存器 内存保护的实现机理,如下图所示 课堂作业 P267 8.1 P268 8.9 8.12 Two-Level Table Scheme Two-Level Paging Example A logical address (on 32-bit machine with 4K page size) is divided into: a page number consisting of 20 bits 页号 a page offset consisting of 12 bits 页偏移 Since the page table is paged, the page number is further divided into: a 10-bit page number 页号 a 10-bit page offset 页偏移 Thus, a logical address is as follows: where pi is an index into the outer page table, and p2 is the displacement within the page of the outer page table P1是用来访问外部页表的索引,p2是外部页表的页偏移 page number page offset pi p2 d 10 10 12 Address-Translation Scheme Three-level Paging Scheme Since each level is stored as a separate table in memory, covering a logical address to a physical one may take three memory accesses.(由于每一级都以单独的页表形式存储在内存中,把一个逻辑地址转换为一个物理地址可能要进行3次内存存取页表。) Even though time needed for one memory access is fourfold, caching permits performance to remain reasonable.(尽管每次内存存取的时间要4倍于内存时间,但使用高速缓存就可以使的指令的执行时间还是可以接受的) Linux的分页机制 3级页表 Hashed Page Tables Common in address spaces 32 bits The virtual page number is hashed into a page table. This page table contains a chain of elements hashing to the same location. 逻辑页号被做了一层哈希(因为逻辑页号也比较大) Virtual page numbers are compared in this chain searching for a match. If a match is found, the corresponding physical frame is extracted. Hashed Page Table Inverted Page Table反向页表 One entry for each real page of memory.(一个内存中页的表项。) Entry consists of the virtual address of the page stored in that real memory location, with information about the process that owns that page.(表项包含真正内存地址的页的虚拟地址,它包括拥有这个页的进程的信息。) Decreases memory needed to store each page table, but increases time needed to search the table when a page reference occurs.(减少内存需要储存每个页表,但是当访问一个页时,寻找页表需要增加时间。) Use hash table to limit the search to one — or at most a few — table entries.(使用哈希表来减少搜索。) Inverted Page Table Architec

文档评论(0)

1亿VIP精品文档

相关文档