Interview prompt
Explain virtual memory and the page-fault path to an engineer who understands the surrounding system but has not used this technique. Walk from its contract to a concrete operation, then discuss where it fails or becomes expensive.
A strong answer
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.
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.
A complete answer also calls out the assumptions that control correctness. 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.
Close by describing one representative test or measurement. 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.
Follow-up questions
Answer the follow-ups in the frontmatter. Use the linked article for the concept and the trace to make the explanation concrete.