Operating Systems8h estimated

Virtual Memory

Difficulty
Importance

The problem

Multiple processes need to use memory addresses without stepping on each other or on the OS itself, and programs are often written as if they have access to more memory than physically exists — virtual memory gives every process its own private, seemingly-contiguous address space, backed by a translation layer to real physical memory.

Why now

Processes and threads established that each process is isolated, but not how that isolation is actually enforced at the memory-address level. Number systems and bases already explained how addresses are just numbers; virtual memory is the mechanism that remaps those numbers so two processes can both believe they own address 0x1000 without conflict.

Mental model

Every memory address a program uses is fake — a virtual address the CPU's memory management unit translates to a real physical address via a page table, invisibly, on every access. This indirection is what makes process isolation, memory overcommit (swapping unused pages to disk), and giving every process a clean address space starting at zero all possible at once.

Requires

Unlocks

Used in

Projects

  • Diagram how two processes can each use virtual address 0x1000 simultaneously without collision, showing the page table translation for each
  • Trigger and interpret a segmentation fault from an intentionally invalid memory access, and explain what happened at the virtual memory layer

Examples

  • Two running instances of the same program each believe their code starts at the same virtual address, translated to different physical addresses
  • A segmentation fault is the CPU reporting that a virtual address has no valid translation to physical memory

Resources

Mastery checklist