Source: cirosantilli/x86-paging/page-size-choice

= Page size choice

Why are pages 4KiB anyways?

There is a trade-off between memory wasted in:
* page tables
* extra padding memory within pages

This can be seen with the extreme cases:
* if the page size were 1 byte:
  * granularity would be great, and the OS would never have to allocate unneeded padding memory
  * but the page table would have 2^32 entries, and take up the entire memory!
* if the page size were 4GiB:
  * we would need to swap 4GiB to disk every time a new process becomes active
  * the page size would be a single entry, so it would take almost no memory at all

x86 designers have found that 4KiB pages are a good middle ground.