[ SRE_ARENA ]
MEMORY MANAGEMENT

Memory Management: Virtual Illusions & Hard Realities.

Visualization: 1. Virtual Memory & The MMU
DOWNLOADING CONCEPT: 1. VIRTUAL MEMORY & THE MMU...
  • ↳Processes do not see actual physical RAM hardware.
  • ↳Instead, the Linux kernel gives every process a beautiful lie: a massive, contiguous Virtual Memory space.

↳When a process tries to read/write memory, the MMU (Memory Management Unit, a hardware chip on the CPU) intercepts the virtual address and uses the OS's Page Table to translate it into a physical RAM address.

  • ↳If the required data is in RAM, it's a Page Hit (fast!).
  • ↳If the data isn't in RAM (perhaps it was swapped to disk), the MMU triggers a Page Fault (exception).
  • ↳The kernel pauses the process, fetches the data from disk into RAM, updates the Page Table, and resumes the process.
  • ↳This is extremely slow.
▲ LIVE INCIDENTAn engineer reports: 'The database server is out of memory! It has 128GB of RAM, and the database is only using 40GB, but free shows 0!'
sre@arena:~/memory-management
sre@arena:~$ free -mh