The page table size calculator gives the number of virtual pages, the size of a flat page table, the levels of a multi-level table and the TLB reach from the address width, the page size and the entry size.
How the calculation works
- Enter the virtual address width and pick the page size.
- Enter the size of a page table entry and the TLB entries.
- The calculator gives the pages, the flat table size, the levels, the entries per table, the TLB reach and the address space.
Example
A 48-bit address space with 4 KB pages has 36 bits of page number, so 68.719 billion pages. At 8 bytes per entry, a flat table would take 549.8 GB. Each 4 KB table holds 512 entries (9 bits), so 4 levels are needed. A TLB of 64 entries reaches 256 KB.
Why it matters
The calculator helps computer science students, kernel developers and performance engineers to understand why operating systems use trees of page tables and how page size affects memory use and TLB misses.
Good to know
In x86-64 with 4 KB pages, the four levels each decode 9 bits, and a fifth level extends the address to 57 bits. Using 2 MB pages removes one level and multiplies the TLB reach by 512, at the price of more internal waste and more complex memory management. Each level adds a memory access on a TLB miss, which is why caches of partial translations exist inside the processor. The numbers here count the tables of a fully populated space, and a real process uses far less. Page table entries also hold flags such as present, writable and accessed, within the 8 bytes. For a system with a 32-bit address and 4 KB pages, two levels of 10 bits are enough.
Related tools
The average memory access time calculator includes the cost of misses, the cache hit ratio calculator describes caches, the hash collision calculator covers lookups and the roofline model calculator relates memory bandwidth to performance.