demand paging
Imagine moving into a huge house but only unpacking a box the first moment you actually need something from it, rather than unpacking all hundred boxes on day one. Most boxes you never open. Demand paging is this lazy strategy for memory: instead of loading an entire program into RAM before it runs, the system loads each page only when the program first touches it — on demand.
Concretely, when a program starts, its pages are mostly marked not-present in the page table (valid bit 0); the program's contents sit in the executable file or swap area on storage. The program begins executing immediately. The first time it accesses a given page, the absent valid bit triggers a page fault, the OS reads just that one page into a frame, marks it valid, and resumes. Pages that are never touched are never loaded at all. This is why a giant program can start almost instantly and why a process can have a virtual address space far larger than physical RAM — only the actively-used pages ever occupy frames.
Why it matters: demand paging is what makes 'run programs larger than physical memory' real, and it dramatically cuts startup time and memory footprint, since programs typically use only a fraction of their address space. The honest catch is the very first access to each page pays a page-fault cost, and if the set of needed pages exceeds available frames, the system starts evicting pages it will soon need again — thrashing. So demand paging is a bet on locality: it pays off precisely because programs concentrate their accesses on a small working set at any moment.
Launch a 2 GiB application on a 1 GiB machine. It starts instantly because only its startup pages fault in; the gigabytes of features you never use simply never leave storage.
Load nothing until touched: pages arrive one fault at a time, only as needed.
Demand paging relies on locality to win. Without it — if a program touched its pages randomly and uniformly — it would fault constantly and thrash, and eagerly loading everything would be better. Real programs have locality, so demand paging almost always pays off.