The Runtime Theory
Virtual Memory and Page Faults

Virtual Memory and the Page-Fault Path

Virtual memory lets each process use an address space that is translated through page tables and hardware translation caches.

The Runtime Theory Team5 min read#virtual-memory#paging#page-faults
▸ On this page

The model

Virtual memory lets each process use an address space that is translated through page tables and hardware translation caches. Pages provide the unit for mapping, protection, and often movement between RAM and storage. This abstraction supports isolation and flexible placement, but translations and misses have real costs.

A concrete walk-through

On a memory access, the processor first uses a translation lookaside buffer when possible. If translation is absent, hardware or the kernel walks page tables. If the mapping is valid but not resident, a page fault transfers control to the kernel, which may allocate a page, load data, or reject an invalid access.

Costs and failure cases

A page fault is not always an error: demand-zero allocation and copy-on-write can be handled transparently. A major fault that requires storage I/O is much slower than a minor fault resolved without disk access. Poor locality can cause repeated faults and thrashing.

Check your understanding

After a process forks, explain why the parent and child may initially share physical pages yet observe independent writes. Identify the fault mechanism that enables this behavior.

Further reading

Operating Systems: Three Easy Pieces

Not started

Sign in to save your learning progress.

Sign in to save