Part 1 of 6 · 1 min read
Why this page comes first
In this module you will
- Explain what an address space is, and why every process gets its own.
- Tell a logical (virtual) address from a physical address.
- Translate an address with a base register and a limit register, and say when the hardware raises a trap.
- Read the layout of a real process from its printed addresses and from
/proc/self/maps. - Explain what address randomisation changes, and what it does not.
Levels 1 to 5 treated memory as something a process simply has. This level opens the box. A computer has one pool of physical memory, and many processes that all believe they own a large, private, continuous memory starting at a low address. The operating system and a piece of hardware work together to keep that belief true. This page gives the first, simplest form of the trick, base and limit registers, and the picture of what a process sees. Pages 2 and 3 show why the simple form is not enough and what replaces it. The sources are "Operating Systems: Three Easy Pieces" (OSTEP) chapters 13 to 15, "Operating System Concepts" (OSC) chapter 9 and "Modern Operating Systems" (MOS) chapter 3. All programs were compiled with gcc -Wall -Wextra and run on a two-processor Linux machine with 4,096-byte pages.
About this example About this example
Real: The C programs, commands and outputs on this page were compiled with gcc -Wall -Wextra -pthread and run on a Linux test machine (2 processors, kernel 6.18, glibc 2.39).
Scripted: The worked traces use small numbers chosen so they can be followed by hand.
Not real: The page simplifies real systems. Actual kernels add more cases, limits and tuning than a short page can show.