Virtual vs Physical Address Spaces
What you'll learn: How the addresses your programs "see" differ from the actual locations in your computer's RAM.
The Two Address Worlds
When your program accesses memory, it uses virtual addresses—numerical locations that exist in its own private address space. Meanwhile, the hardware stores that data at a completely different physical address in the actual RAM chips.
Think of it like a hotel analogy: guests think in terms of room numbers (virtual addresses), but the hotel staff knows the actual GPS coordinates and building layout of each room (physical addresses). The guest never needs to know the physical location—they just use the room number, and the system handles the translation.
Why Two Separate Spaces?
The virtual address space is the range of addresses a program can potentially use—often starting at 0 and extending to some large number (like 2³² or 2⁶⁴). Every process gets its own virtual address space, which is why two programs can both have variables "at address 0x1000" without conflict.
The physical address space is the actual hardware memory—the real RAM installed in your computer. It's finite, shared among all processes, and must be managed carefully.
The Magic: Address Translation
Between these two worlds sits the address translation mechanism (hardware + OS cooperation). When a program accesses virtual address 0x1000, the system transparently translates it to physical address 0x4A8F000 (or wherever that data actually lives in RAM).
This separation enables all the benefits of virtual memory: isolation between processes, the illusion of abundant memory, and flexible memory management.
Key Takeaway: Virtual addresses are what programs use; physical addresses are where data actually resides in RAM. Address translation bridges these two distinct address spaces invisibly.