简体   繁体   English

如何在分层配置中计算页表的大小

[英]How to calculate the size of a page table in a hierarchial configuration

If we have the following configuration for example, how can we calculate the size of the page table 例如,如果我们具有以下配置,我们如何计算页面表的大小

A computer uses 46–bit virtual address, 32–bit physical address, and a three–level page table organization. 计算机使用46位虚拟地址,32位物理地址和三级页表组织。 The page table base register stores the base address of the first–level table, which occupies exactly one page. 页表基址寄存器存储一级表的基地址,该表正好占据一页。 Each entry of the first level page table stores the base address of a page of the second–level table. 第一级页表的每个条目都存储第二级表的页的基地址。 Each entry of the second level page table stores the base address of a page of the third–level table. 第二级页表的每个条目存储第三级表的页的基地址。 Each entry of the third level page table stores a page table entry (PTE). 第三级页表的每个条目都存储一个页表条目(PTE)。 The PTE is 32 bits in size. PTE的大小为32位。 The processor used in the computer has a 1 MB 16 way set associative virtually indexed physically tagged cache. 计算机中使用的处理器具有1 MB 16路径组关联的虚拟索引物理标记的缓存。 The cache block size is 64 bytes. 缓存块大小为64个字节。

Find page size first. 首先查找页面大小。 Then you can calculate the page table size from that. 然后,您可以据此计算页表的大小。

All the page table reside in the physical memory(RAM) since the physical address is 32 bit addressable each level table holds a 32 bit (4 byte)address of the RAM 所有页表都驻留在物理内存(RAM)中,因为物理地址是32位可寻址的,每个级别表都拥有RAM的32位(4字节)地址

Assume the size of a page is x bytes. 假设页面的大小为x字节。 (which we need to find) (我们需要找到)

As the size of level 1 table is also x (as given in the question that level 1 table accommodate exactly a page)it can hold x/4 base addresses of x/4 level 2 tables (which also accommodate exactly a page) and each level 2 table hold base addresses of x/4 level 3 tables. 由于1级表的大小也为x(如1级表恰好容纳一个页面的问题所示),因此它可以容纳x / 4个2级表(也恰好容纳一个页面)的x / 4基地址,并且每个2级表包含x / 4 3级表的基地址。

the level 3 table has entities equal to 2^46/x 3级表的实体等于2 ^ 46 / x

ie. 即。 (x/4)(x/4)(x/4) = 2^46/x (x / 4)(x / 4)(x / 4)= 2 ^ 46 / x

on solving x=8192 which is in bytes so 8192/1024 = 8 K bytes 在解决x = 8192(以字节为单位)时,8192/1024 = 8 K字节

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM