Why Are Memory Pages and Frames Fixed at 4 KB?

Physical memory frames and virtual memory pages are divided into fixed-size blocks, commonly 4 kilobytes, to simplify memory management, eliminate external fragmentation, and enable fast hardware address translation. This design strikes a practical balance between minimizing wasted memory inside allocated blocks and keeping the metadata required to track those blocks small enough to manage efficiently.

Eliminating External Fragmentation

When memory is allocated in variable-sized chunks, freeing and reallocating blocks of different sizes leaves behind small, non-contiguous gaps of free memory. Over time, this external fragmentation makes it difficult to find a single contiguous block large enough for a new allocation, even when the total amount of free memory is sufficient.

Dividing both physical RAM into frames and virtual address spaces into pages of the exact same fixed size solves this problem. Any free physical frame can hold any virtual page. The operating system never needs to search for a specific-sized hole or compact memory to make room for a process, because every block is interchangeable.

Fast Address Translation with Bitwise Operations

Fixed-size blocks that are powers of two allow the CPU's Memory Management Unit (MMU) to translate virtual addresses into physical addresses using simple bit manipulation rather than expensive division or multiplication. For a standard 4 KB page size, the size in bytes is:

\[4\text{ KB} = 4096\text{ bytes} = 2^{12}\text{ bytes}\]

Because \(4096 = 2^{12}\), any byte within a page can be addressed using the lowest \(12\) bits of a virtual address. The MMU splits a virtual address into two parts:

  • Page Offset: The lower \(12\) bits, which identify the exact byte within the page and remain unchanged during translation.
  • Virtual Page Number (VPN): The remaining upper bits, which the MMU uses to look up the corresponding physical frame number in the page table.

Concatenating the physical frame number with the \(12\)-bit offset produces the final physical address in a single hardware step.

Balancing Internal Fragmentation and Page Table Size

Choosing the exact block size involves a trade-off between two competing costs:

  • Internal Fragmentation: Memory allocated to a process that goes unused because the process does not fill the entire last page. On average, a process wastes half a page per contiguous allocation, or about \(2\text{ KB}\) for a \(4\text{ KB}\) page size. Larger pages increase this waste.
  • Page Table Overhead: The memory required to store the mapping between virtual pages and physical frames. Smaller pages mean more total pages in a given address space, which increases the size of the page tables and puts more pressure on the Translation Lookaside Buffer (TLB), the CPU's cache for recent address translations.

A \(4\text{ KB}\) block size sits in the sweet spot for general-purpose computing. It keeps internal fragmentation low enough for typical workloads while keeping page tables manageable.

Alignment with Storage and Hardware

Historically, \(4\text{ KB}\) also aligned well with the sector and block sizes of storage devices and file systems. When the operating system swaps a memory page out to disk or reads a file into memory, transferring data in \(4\text{ KB}\) chunks matches the natural block size of the underlying storage hardware, reducing I/O overhead. Although modern systems also support larger "huge pages" (such as \(2\text{ MB}\) or \(1\text{ GB}\)) for memory-intensive applications, \(4\text{ KB}\) remains the foundational default in classical computing architectures.