pagingramvirtual-memory

What is page tables, pages, and page table entry?


I am really confused about these 3 things and I have been trying to understand this for a good solid 2 hours and no luck.

Q. If I have a 47-bit virtual address space with a page size of 16 KB and that page table entry takes 8 bytes. How many levels of page tables would be required to map the virtual address space if every page table is required to fit a single page?

I know what a page table is, but what exactly is the difference between a page table entry and a page? In the answer key, it starts off with this:

A 1-page page table contains 2^11 PTE (x8 bytes), pointing to 2^11 pages (addressing 2^25 bytes). Can someone explain to me where 2^11 pages came from?

More or less, I am confused about what it means by a page and what the difference is with a page table entry.


Solution

  • The logical address space into an array of PAGES. In your case a page is 16KB or 2^14 bytes.

    The PAGE TABLE contains the mappings from pages to physical PAGE FRAMES where the size of the page frame is the same as the page size.

    Your answer (but not question) states a page table entry is 8 bytes (2^3). Assuming that is correct you can fit 2^14 / 2^3 = 2^11 page table entries into a single page.

    If you have a 2^47 bit address space, you'd need 2^47 / 2^14 = 2^33 page table entires to span the entire address space. You'd need 2^33 / 2^11 = 2^22 pages worth of page table entries.

    This question presumes using nested page tables.

    (2^11)^2 = 2^22

    You then need two levels of page table.

    The entire question is rather stupid, contrived, and does not reflect the real world. I cannot believe that operating systems are taught in this way.