A page frame is a fixed-size block of physical memory into which the operating system loads exactly one virtual page. In memory management for modern operating systems, physical RAM is divided into equal frames, typically 4 KiB each, and the kernel maps the pages of every process onto these frames through page tables.
Frames are the unit of physical allocation: the kernel never hands out half a frame, and every decision about loading, evicting, sharing or locking memory is ultimately a decision about frames. Understanding frames explains why paging avoids external fragmentation, how memory is shared between processes, and why physical memory pressure behaves the way it does.
How page frames relate to virtual pages
A page frame is the physical counterpart of a virtual page. Virtual memory divides each process address space into pages, and physical memory is divided into frames of the same size, so any page can be placed in any free frame without regard to its neighbors.
Translation works by splitting a virtual address into a page number and an offset. The memory management unit looks up the page number in the page table, which stores a page frame number (PFN). The PFN is combined with the unchanged offset to form the physical address. With 4 KiB pages, the lowest 12 bits of the address are the offset and pass through untouched.
The table below separates the concepts that are most often confused when frames are first discussed.
| Concept | Lives in | Identified by | Role |
|---|---|---|---|
| Virtual page | Process address space | Virtual page number | Unit of the program’s view of memory |
| Page frame | Physical RAM | Page frame number | Unit of physical storage |
| Page table entry | Kernel memory | Index in the table | Maps one page to one frame plus flags |
| Swap slot | Disk or compressed store | Slot offset | Holds a page evicted from its frame |
Because the mapping is per page, contiguous virtual memory does not need contiguous frames. A 1 MiB buffer that looks continuous to a program may be scattered across 256 frames anywhere in RAM. This is the main reason paging eliminates external fragmentation at the level of process memory.
Frame sizes and hardware support
The frame size is fixed by the processor architecture, not chosen freely by the kernel. Most systems use a 4 KiB base size, and many architectures also support larger frames for huge pages, which reduce the number of translation lookaside buffer entries needed to cover large data sets.
The following table lists common frame sizes and where they appear.
| Architecture | Base frame size | Larger frame sizes | Typical use of large frames |
|---|---|---|---|
| x86-64 | 4 KiB | 2 MiB, 1 GiB | Databases, virtual machines |
| ARM64 (AArch64) | 4 KiB, 16 KiB or 64 KiB | 2 MiB, 32 MiB, 512 MiB, 1 GiB | Servers, Apple silicon uses 16 KiB |
| RISC-V (Sv39) | 4 KiB | 2 MiB, 1 GiB | Embedded and server systems |
| POWER | 4 KiB or 64 KiB | 16 MiB, 16 GiB | Large enterprise workloads |
A larger base frame lowers page table overhead and improves TLB reach, but it increases internal fragmentation, because a process that needs 5 KiB still consumes two full frames. On average, internal waste is about half a frame per memory region, which is negligible at 4 KiB and noticeable at 64 KiB.
How the kernel tracks every page frame
The kernel keeps a descriptor for each physical frame so it can answer who uses the frame, whether it is dirty and whether it can be reclaimed. In Linux this is struct page, stored in an array often called the mem_map, and each descriptor costs about 64 bytes, roughly 1.6 percent of RAM.
Free frames are managed by a physical page allocator. Linux uses buddy memory allocation, which groups free frames into power-of-two blocks so that contiguous runs can be split and merged quickly. Windows keeps frames on lists in its PFN database, such as the free, zeroed, standby and modified lists.
| Frame state | Meaning | Can be reclaimed |
|---|---|---|
| Free or zeroed | Not mapped, ready for allocation | Already available |
| Active, clean | Mapped and unchanged since loading | Yes, by dropping it |
| Active, dirty | Mapped and modified in memory | Only after write-back |
| Pinned or locked | Fixed for DMA or by mlock | No |
| Kernel or slab | Holds kernel structures | Rarely, by shrinking caches |
Each descriptor also holds a reference count and a mapping count. When several processes map the same frame, as with shared libraries or copy-on-write after a fork, the frame is freed only when the last reference disappears.
Page frame allocation and reclaim
Frames are usually assigned lazily through demand paging. When a process touches a page that has no frame, a page fault occurs, the kernel takes a free frame, fills it from a file or with zeros, and updates the page table entry.
When free frames run low, the kernel must reclaim frames from other uses. A page replacement algorithm chooses victims, typically approximating least recently used with accessed bits. Clean file-backed frames are simply dropped, while dirty or anonymous frames must first be written to the file or to swap.
The table below summarizes the main sources of frame demand and how each behaves under pressure.
| Consumer | Backing store | Cost of reclaim |
|---|---|---|
| Page cache (file data) | File on disk | Low if clean |
| Anonymous memory | Swap or compressed memory | High, needs a write |
| Kernel slab caches | None | Moderate, needs shrinking |
| Huge page reservations | None or swap | High, contiguity is hard to rebuild |
If reclaim cannot keep up, the system starts thrashing, spending more time moving pages than running work, and the kernel may eventually invoke an out of memory killer to free frames by ending a process.
Common misconceptions about page frames
- Frames and pages are not synonyms. A page is a virtual unit and a frame is a physical one, although the sizes match.
- Free RAM is not wasted RAM. Operating systems deliberately fill idle frames with page cache, which is released quickly when needed.
- One frame can serve many pages. Shared libraries and copy-on-write let several virtual pages in different processes point to a single frame.
- Paging does not remove all fragmentation. It removes external fragmentation for process memory, but physical contiguity still matters for huge pages and some device drivers.
Understanding it simply
Think of the computer’s memory as a wall of identical lockers. Each locker is a page frame. Every locker has the same size and a number.
A program does not know which lockers it uses. It works with its own list of numbered boxes. The operating system keeps a map from boxes to lockers. A box can sit in any empty locker, so the program never needs a long row of free lockers side by side.
When all lockers are full, the system empties one. It writes the content elsewhere if needed. The page frame is simply the physical slot where a piece of a program lives right now.
Applied in practice
A system administrator runs a database server with 64 GiB of RAM on x86-64 Linux. With 4 KiB frames, the machine has about 16.7 million page frames, and the database buffer pool alone occupies 40 GiB, or roughly 10 million frames. Monitoring shows frequent TLB misses and high page table overhead.
The administrator reserves 2 MiB huge pages for the buffer pool at boot, while contiguous physical memory is still available. The 40 GiB pool now needs only 20,480 large frames, page table memory drops sharply, and query latency improves measurably. Ordinary processes keep using 4 KiB frames, so small allocations stay efficient while the large, long-lived buffer gains the benefit of bigger frames.