Virtual Memory: Big Picture

Big Picture

../../../../../../_images/virtual-memory-basics.svg

Terms

  • MMU: Memory Management Unit; sits between CPU and cache/physical memory

  • TLB: Translation Lookaside Buffer, used by the OS to communicate address translations to the MMU

  • Kernel Page Tables (not shown): used by the kernel to keep track of a process’s allocations - TLB is set up from page tables

  • Virtual Memory: idealized view of memory as seen by a process

  • Physical Memory: real RAM, as allocated to processes (and kernel itself, of course).

Facts

  • Memory is managed in units of pages (4K on most architectures, but see sysconf(_SC_PAGESIZE))

  • Physical memory becomes fragmented over time ⟶ contiguous allocations beyond page size generally impossible

    • This is only relevant for the kernel, as userspace cannot allocate physical memory - this is what virtual memory has been made for