/ˈpeɪdʒ rɪˈpleɪsmənt/

noun — "choosing which memory page to evict."

Page Replacement is the mechanism used by an operating system to decide which memory page should be removed from physical memory when space is needed to load a new page. It is a core component of virtual memory systems, enabling programs to operate as if they have access to more memory than is physically available by transparently moving data between fast main memory and slower secondary storage.

Technically, page replacement operates at the boundary between physical memory and backing storage, such as disk or solid-state drives. When a running process accesses a virtual memory address whose corresponding page is not resident in physical memory, a page fault occurs. If free memory frames are available, the required page is simply loaded. If memory is full, the operating system must select an existing page to evict. This decision is governed by a page replacement algorithm, whose effectiveness has a direct impact on system performance.

Page replacement algorithms attempt to minimize costly page faults by predicting which pages are least likely to be accessed in the near future. Common strategies include FIFO, which evicts the oldest loaded page regardless of usage; LRU, which evicts the page that has not been accessed for the longest time; and clock-based algorithms, which approximate LRU using reference bits to reduce overhead. More advanced systems may use adaptive or hybrid approaches that account for access frequency, process behavior, or working set size.

From an operational perspective, page replacement must balance accuracy with efficiency. Tracking exact access history for every page is expensive, especially in systems with large memory spaces and high concurrency. As a result, most real-world systems rely on approximations that leverage hardware support such as reference bits, dirty bits, and memory management units. Dirty pages, which have been modified since being loaded, must be written back to disk before eviction, adding additional cost and influencing eviction decisions.

Consider a simplified conceptual workflow:


if page_fault occurs:
    if free_frame exists:
        load page into free_frame
    else:
        victim = select_page_to_evict()
        if victim is dirty:
            write victim to disk
        replace victim with requested page

This flow highlights the essential role of page replacement as a decision-making step that directly affects latency, throughput, and system stability.

In practice, effective page replacement keeps a process’s working set, the subset of pages actively in use, resident in memory. When the working set fits within physical memory, page faults are infrequent and performance is high. When it does not, the system may enter a state known as thrashing, where pages are constantly evicted and reloaded, causing severe performance degradation. Preventing thrashing requires careful tuning of replacement policies, memory allocation, and scheduling decisions.

Page replacement is closely tied to broader system behavior. Databases rely on buffer pool replacement policies to manage cached disk pages. Filesystems use similar logic for block and inode caches. Even hardware-level caches in CPUs implement replacement strategies that mirror the same fundamental problem at smaller scales. Across all these contexts, the goal remains consistent: maximize the usefulness of limited fast storage by keeping the most relevant data resident.

Conceptually, page replacement is like managing a small desk while working on a large project. When the desk is full and a new document is needed, one of the existing documents must be moved away. Choosing the one you have not looked at in a long time is usually better than discarding something you were just using.

See Virtual Memory, LRU, FIFO, Cache.