memorymemory-managementoperating-systempagingpage-tables

Let's say we have a 32-bit system, or 64-bit system, or even 128-bit system. What's the size of each page table entry?


So a page table entry contains the physical page address in memory, some bits like dirty/valid/use bit and maybe some unused bits correct?

Given a system that can be 32 bits, or 64 bits, or even 128 bits (theoretically speaking of course), how do you determine the size of each page table entry?

As a follow-up question, how many levels of page tables, if a red-black, radix tree structure is used for the paging scheme, are needed?


Solution

  • You look up that information in the manual for the specific system.

    There is no direct relationship between the bitness of the system, and the sizes you've mentioned. There is a lot of leeway for the hardware designers to decide.

    Page table entry has to be as long as needed to store all necessary information. It depends on the functions the MMU supports, and on the width of the physical address (which might be different from the stated "bitness" of the CPU, different from the size of the registers and the virtual address!). For example:

    Number of levels has even more leeway. We start from virtual address bitsize (which can be smaller than the stated bitness - 64-bit CPUs currently have less than 64 virtual address bits!) and subtract the page offset bitsize (which depends on the minimal page size), and we get page index size - but how to split it between layers is entirely up to an architecture designer!