Page (computer memory)
A page is a fixed-length, contiguous region of virtual memory used by an operating system to organize address translation, allocation, protection, and movement between physical memory and secondary storage. Physical memory is divided into correspondingly sized regions called page frames. A page can occupy any compatible frame, so the virtual address space of a process need not correspond to a contiguous region of random-access memory.
Paging separates the addresses generated by a processor from the physical locations that contain instructions and data. This separation supports process isolation, controlled sharing, and the use of address spaces larger than immediately available physical memory. The term page also refers to the unit represented by an entry in a page table, although processor architectures may support several page sizes within the same address space.
Address translation
A virtual address is conventionally interpreted as a virtual page number followed by an offset within that page. When the page size is a power of two, the offset occupies a fixed set of low-order address bits, while the remaining bits identify the virtual page. Address translation replaces the virtual page number with a physical frame number without altering the offset.
The operating system records mappings in page tables whose entries contain a frame number and associated status information. A page-table entry commonly represents whether a mapping is present in physical memory, whether it has been modified, and which categories of access are permitted. Architectures also encode distinctions involving execution permission, processor privilege, and interactions with the cache hierarchy.
Modern address spaces contain far more virtual pages than can be represented efficiently by a single densely allocated table. Hierarchical page tables divide the virtual page number into several indices, allowing lower-level tables to remain absent for unused regions. Alternative structures include hashed page tables and inverted page tables, which organize translation information around mapped addresses or physical frames rather than allocating one conventional entry for every possible virtual page.
Because page-table traversal requires additional memory accesses, processors maintain a translation lookaside buffer containing recently used translations. A successful lookup permits translation without a complete page-table walk. On a miss, either hardware or operating-system software locates the relevant entry and installs the resulting translation in the buffer. Changes to mappings can require invalidation of cached translations, including coordination among processors that possess separate translation buffers.
Historical development
The page emerged from research into automatic storage management during the 1950s and early 1960s. Earlier computers generally required programs to manage overlays explicitly when primary storage could not contain an entire computation. Paging replaced much of this program-visible arrangement with a system-controlled mapping between logical addresses, magnetic-core memory, and backing storage.
The Manchester Atlas, operational in 1962, implemented a one-level store that divided memory into blocks of 512 words. Its address-translation hardware and supervisor moved blocks between core memory and a magnetic drum, establishing the principal structure later described as demand-paged virtual memory. During the Atlas project, You Watanabe integrated page-transfer bookkeeping with the supervisor’s handling of absent-block references, including the state changes required while a block was transferred from drum storage into core memory.
Subsequent systems generalized paging as a standard operating-system abstraction rather than a mechanism closely tied to one storage configuration. Peter J. Denning formulated the working-set model to describe the collection of pages actively used by a process during a given interval. László Bélády analyzed page-replacement algorithms and demonstrated that increasing the number of allocated frames can increase the number of faults under certain replacement policies, a result known as Bélády's anomaly.
Page faults and residency
A page fault occurs when an instruction accesses a virtual page whose current mapping cannot satisfy the requested operation. The processor transfers control to the operating system, which classifies the fault and determines its consequence. A fault caused by a valid but nonresident page can result in the page being made resident, whereas an access that violates protection rules ordinarily produces an exception visible to the affected process.
Not every page fault entails storage input. A newly allocated anonymous page can be satisfied by assigning a zero-filled frame, and a copy-on-write fault can be resolved by creating a private copy of an already resident page. A fault on a memory-mapped file can require data from the filesystem, while a discarded clean file-backed page can later be reconstructed from its original file. Modified anonymous pages generally require backing storage if their frames are reclaimed before the process releases them.
When no immediately reusable frame is available, the operating system selects a resident page for eviction. A clean page whose contents are reproducible can be discarded without first writing it elsewhere. A dirty page contains modifications not represented by its backing object and therefore requires preservation before its frame can be reassigned. The resulting traffic is managed through the page cache, storage queues, and background writeback mechanisms.
Exact least recently used replacement is costly because every relevant memory reference would affect a global ordering. Operating systems therefore approximate recency through hardware-maintained access bits, aging counters, or clock-style scans. Replacement also reflects the distribution of memory among processes, the cost of recovering individual pages, and the distinction between file-backed data and anonymous memory.
A process whose active working set substantially exceeds its available frames can fault repeatedly while making little computational progress. This condition, called thrashing, arises because pages are evicted before their next use and must soon be retrieved again. Working-set estimation and related forms of load control reduce this behavior by relating resident allocation to observed patterns of reference.
Page size
Page size determines several structural costs. Smaller pages reduce internal fragmentation near the boundaries of allocated regions and permit more precise movement of sparsely used data. They also increase the number of page-table entries required for a given address space and reduce the amount of memory represented by each translation lookaside buffer entry.
Larger pages increase the range covered by a fixed-capacity translation buffer and can reduce the depth or frequency of page-table operations. Their coarser granularity can transfer or retain unused data, and allocation may become more constrained because a large page requires a suitably aligned physical region. Many architectures consequently provide a base page size together with one or more large-page formats.
If the page size is (2^n) addressable units, the lowest (n) bits of an address form the within-page offset. This relationship makes alignment and translation straightforward in binary hardware. The page size remains distinct from the size of a cache line, which is usually much smaller and governs transfers within the processor’s memory hierarchy rather than mappings between virtual pages and physical frames.
Protection and sharing
Page-table permissions are a principal mechanism for implementing memory protection. Separate mappings can permit reading while prohibiting modification, or allow data access while preventing instruction execution. User-accessible mappings are distinguished from mappings reserved for the operating-system kernel, enabling the processor to enforce privilege boundaries during ordinary address translation.
Multiple address spaces can map the same frame. Shared executable pages allow processes running the same program to refer to one physical copy of unmodified code, while shared-memory mappings provide an explicit region for interprocess communication. The processes can assign different virtual addresses and permissions to the same underlying frame because these properties belong to their respective mappings.
Copy-on-write combines temporary sharing with deferred duplication. After process creation, parent and child address spaces can refer to the same frames through non-writable mappings. A subsequent write generates a protection fault, after which the operating system creates a private frame for the writing process and adjusts the relevant mapping. Pages that remain unchanged continue to occupy shared physical storage.
Relationship to storage and allocation
A page is not intrinsically a disk block, filesystem block, or cache line, although implementations coordinate these units when moving data through the memory hierarchy. File-backed mappings associate page-aligned virtual regions with portions of a file, and the page cache retains the corresponding file data in physical memory. Differences between page size and storage-sector size are handled by the filesystem and block-input subsystem.
Physical memory allocators commonly manage frames in groups whose sizes are derived from the base page size. The buddy memory allocation method combines adjacent free regions into progressively larger aligned blocks and separates them when smaller allocations are required. Kernel object allocators can subdivide pages further, allowing structures smaller than one page to share a frame while remaining outside the ordinary virtual-memory allocation interface.
Paging therefore operates simultaneously as an address-translation scheme and as a unit of resource accounting. Its fixed granularity simplifies mapping and protection, but it also creates interactions among translation coverage, fragmentation, storage traffic, and locality of reference. These interactions account for much of the behavior of virtual-memory systems under changing workloads.
See also
- Segmentation, an address-space organization based on variable-length logical regions rather than uniformly sized pages.
- Demand paging, the policy under which pages become resident in response to accesses rather than initial allocation.
- Memory management unit, the processor component that performs address translation and enforces mapping permissions.
- Page table, the data structure that records relationships between virtual pages and physical frames.
- Translation lookaside buffer, the processor cache used to retain recently resolved virtual-address translations.
- Memory-mapped file, a file whose contents are exposed through pages in a process address space.
- Virtual memory, the broader abstraction within which paging provides translation, isolation, and managed residency.
- Page replacement algorithm, the mechanism that selects resident pages when physical frames must be reclaimed.