• ↑↓ pour naviguer
  • pour ouvrir
  • pour sélectionner
  • ⌘ ⌥ ↵ pour ouvrir dans un panneau
  • ←→ pour naviguer
  • esc pour rejeter
⌘ '
raccourcis clavier

The Problem

Loading an entire process into RAM at startup is wasteful — many pages may never be used. We need a way to load pages only when they’re actually needed.

Core Idea

Demand paging loads pages from disk only when they are first accessed (on-demand), reducing RAM usage and startup time.

How It Works

  1. Process starts, page table marked with all pages “not present”
  2. Process runs, accesses first page → page fault
  3. OS loads that page from disk into RAM
  4. Subsequent accesses hit RAM (no fault)
  5. If RAM is full, evicts a page (LRU, FIFO, etc.)
demand Proc Process needs page X Fault Page Fault page not in RAM Proc->Fault access Load OS loads page X from disk Fault->Load trap to OS RAM RAM page X now present Load->RAM

Key Properties

  • Lazy loading: pages loaded only when needed
  • Reduces initial RAM usage
  • First access is slow (disk read), subsequent fast
  • Basis for virtual memory systems

Connections

Edge Cases & Gotchas

  • Too many page faults = thrashing
  • Page fault handling overhead (~1ms for disk read)
  • Critical processes may need pages locked in RAM (mlock)