Contiguous memory allocation requires a process to be loaded in one continuous block of RAM, causing external fragmentation (wasted gaps between processes). We need non-contiguous allocation.
Paging divides processes into fixed-size pages and RAM into page frames, allowing non-contiguous allocation and eliminating external fragmentation.
- Process is divided into pages (e.g., 4KB each)
- RAM is divided into page frames of same size
- Page table maps each page to a frame in RAM
- CPU generates logical address = page number + offset
- MMU uses page table to translate to physical address = frame number + offset
- Eliminates external fragmentation (pages can be anywhere)
- Fixed-size pages simplify allocation
- Page table overhead per process
- Internal fragmentation within pages (last page may not be full)
- Built from: Virtual Memory, Page Table
- Builds into: Page Fault, Demand Paging
- Related: Segmentation, TLB
- Contrasts with: Segmentation (fixed vs variable size)
- Internal fragmentation: last page partially filled wastes space
- Page table size grows with process size (use multi-level page tables)
- Every memory access needs page table lookup (slow → use TLB)