How operating systems carve physical memory into usable regions — and why fragmentation is the price we pay.
Modern systems run dozens of processes concurrently. The OS must allocate, protect, and reclaim RAM — or everything collapses into chaos.
Logical addresses translate to physical ones transparently at runtime.
Hardware barriers prevent any process from touching another's memory.
Multiple processes share one physical copy of common library code.
Segmented logical view maps onto a flat physical address space.
Three fundamental approaches to dividing RAM — each with trade-offs between simplicity, efficiency, and fragmentation.
Memory is divided into a fixed number of partitions at system boot time. Partitions may be equal-sized or of varying sizes. A process must fit into a single partition. partition table in OS max P = num partitions
Partitions are created at runtime, sized exactly to the process request. No internal fragmentation — but holes accumulate as processes exit. uses First/Best/Worst Fit holes block large requests
Memory is always allocated in power-of-2 sized blocks. When a block is freed, it checks if its "buddy" is also free — if so, they merge back into a larger block. Elegant recursion. used by Linux kernel 256KB → 128KB + 128KB
When a new process arrives, which free hole does it go into? Three algorithms, same memory state, different choices.
// Simulator ready
Load a preset or define your own memory layout. Watch fragmentation accumulate in real-time. Switch algorithms. Run compaction.
LAUNCH MEMORY SIMULATOR ▶