Demand Paging
Subject: Computer and Technology noun /dɪˈmænd ˈpeɪ.dʒɪŋ/ 1 definition
- operating-systems
- memory-management
- virtual-memory
- computer-architecture
-
Definition (noun)
Entry #209 · UpdatedDemand Paging is a virtual memory management technique in which an operating system loads fixed-size memory blocks (pages) into physical memory only when a running process attempts to access them, rather than reading an entire program upfront. Unallocated or nonresident pages are initially marked invalid in the process's page table; referencing one causes the memory management unit to raise a page fault, prompting the kernel to allocate a physical frame, populate it from backing storage or with zeros, update the mapping, and restart the faulting instruction. By confining allocation to the active working set, it lowers startup latency and lets virtual address spaces exceed installed physical memory, though excessive fault rates can degrade throughput into thrashing.
Common Forms
Pure Demand Paging: Starts a process with zero pages resident in physical memory, loading the initial instruction page and every subsequent page strictly after a page fault occurs.
Clustered Demand Paging: Loads the faulting page alongside a small contiguous group of neighboring pages in a single storage read, amortizing I/O overhead when accesses show spatial locality.
Demand-Zero Paging: Defers physical frame allocation for anonymous memory regions such as the heap, stack, or uninitialized data segments until first access, resolving the fault with a zero-filled frame rather than a disk read.
File-Backed Demand Paging: Maps executables, shared libraries, or memory-mapped files directly into virtual address space so clean pages are fetched lazily from the filesystem and can be discarded without writing to swap.
Example
When a developer runs a 128 MiB compiler binary solely to check
--version, the operating system maps its executable segments into virtual memory with the page-table entries initially marked nonresident. Executing the entry point faults in only the few 4 KiB pages required to print the version string and exit, skipping tens of megabytes of unnecessary storage reads.