简体   繁体   中英

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. 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). The PTE is 32 bits in size. The processor used in the computer has a 1 MB 16 way set associative virtually indexed physically tagged cache. The cache block size is 64 bytes.

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

Assume the size of a page is x bytes. (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.

the level 3 table has entities equal to 2^46/x

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

on solving x=8192 which is in bytes so 8192/1024 = 8 K bytes

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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