Address Translation Overview
You'll learn how your CPU and operating system collaborate to map program addresses into actual memory locations, powering the virtual memory illusion.
The Translation Problem
Every memory address your program uses is a virtual address—a pretend location in its own private address space. But RAM only understands physical addresses—the real hardware locations. Before any memory access completes, the system must translate virtual → physical. This is address translation.
How the MMU Works
The Memory Management Unit (MMU) is specialized hardware inside or near the CPU that performs this translation automatically on every memory reference.
Here's the flow:
- Your program executes:
load R1, 0x4000(virtual address) - The MMU intercepts
0x4000 - It consults a translation table (set up by the OS)
- It converts
0x4000→ perhaps0x12000(physical address) - The real memory access happens at physical location
0x12000 - Your program never knows the difference
Why This Matters
Without address translation, you couldn't have:
- Isolation: Each process thinking it owns all memory
- Protection: Preventing processes from accessing each other's data
- Flexibility: Loading programs anywhere in physical RAM
- Swapping: Moving memory contents to disk when RAM is full
Think of it like mail forwarding: your program writes to "123 Virtual Lane," but the MMU ensures delivery to the real building at "789 Physical Street."
The OS sets up the translation rules; the MMU enforces them at hardware speed.
Key Takeaway:
Address translation is the hardware mechanism (via the MMU) that converts every virtual address into a physical address, making virtual memory possible.