How Operating Systems Manage Memory Between Programs and Hardware
When a program requests memory, the OS allocates it in fixed-size units called pages, typically 4KB, rather than handing over raw physical RAM. Virtual memory creates an illusion of contiguous space, while the CPU's Memory Management Unit (MMU) maps each virtual page to a physical memory frame scattered across actual hardware. Traditionally, the sbrk() system call managed heap boundaries by moving a 'program break' line, but this approach is now deprecated on modern architectures like ARM64 and RISC-V. Modern memory allocators instead use mmap() to request memory pages directly from the OS, avoiding the fragmentation problems that plagued the older program-break method. The page-based system also provides security and efficiency benefits, isolating processes from each other and enabling the OS to swap unused pages to disk when physical RAM runs low.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)
Log in to join the discussion and vote.
Log in