The Stack and the Heap

Memory addresses in a process are virtualized and segmented. A piece of hardware called a memory management unit (MMU) translates between the addresses that our program can see and the much more complex hardware devices, all while ensuring isolation as multiple programs run simultaneously. It does this by assigning chunks of memory, called pages, to specific positions in the address space of a single program. For example, if there are two programs running at the same time on my computer, they can both have access to totally different objects with the memory address 0x12345678, because the OS has mapped different pages of RAM to that address.

A running program with an isolated address space is called a process. (You’ll ...

Get Modern Systems Programming with Scala Native now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.