In a 3-level paging system, when every page size is 512 bytes and an entry size is 4 bytes, we can know that every single page has 128 entries. So we can design 7 bits (log128) of the VPN(Virtual Page Number) as an index in the third level page table, which makes the page table fit perfectly in a page. What happens if we just design 6 bits as an index? I think on third level page table, some pages could not be correctly "transfer" to corresponding physical frame number because their page number can not be represented by a six-digit index. For example, when the OS "cut" the whole page table into 3 parts, each of which has 128 entries, and one entry happens to be the 100th entry of second part. How can we use 6 digits to index into 100 to get the right frame number in physical address? Or the "cut" process is smart enough to put just 64 entries and waste another 64 entries in every page? Or we actually can use 8 digits to index into 128 entries table, using just 7 digits and ignore one digit? This problem really confuses me a lot because even if the third level page table perfectly fits into one page, the first and the second level page table sometimes do not fit perfectly at all.
Asked
Active
Viewed 163 times
0
-
If entry size is not the same in each level, this problem might be solved? – Zhiren Zhou Sep 13 '22 at 21:07
-
Is it possible that if the 3-lv page table fits perfectly in one page(7 digits index to 128 entries), we just store PFN(Page Frame Number) of the 3-lv page table in the 2-lv page table. If the 3-lv page table does not fit perfectly in one page, we store full physical address(PFN+OFFSET) in the 2-lv page table? So that there is no waste of memory even if the size of table does not equal to the size of page. – Zhiren Zhou Sep 13 '22 at 21:32
1 Answers
-1
I got the answer from Stack Exchange and here is the same question https://cs.stackexchange.com/questions/103454/what-does-it-mean-the-outer-level-page-table-need-not-be-page-aligned.

Zhiren Zhou
- 11
- 1