Why does every program think it has the memory to itself?
Every program on your computer believes it owns a huge, private block of memory. The operating system and the processor are in on the trick.
▶ Start the storyEvery program thinks it has the memory to itself because the operating system gives each one its own pretend set of addresses, called virtual memory. The program uses ; the operating system, with help from the processor, maps them onto real, physical addresses. A piece of hardware in the CPU, the , does the translating automatically. The result is an illusion of a very large main memory, and each program appears to have sole access to it.
Think of a hotel where every guest is told "your room is room 1". Each guest finds room 1 by their own key, and the front desk quietly sends one to the third floor and another to the seventh. The same virtual address in two programs can point to different physical memory, so a bug in one program cannot overwrite the other's data.
The trick also stretches memory. Because the mapping is only a mapping, some of a program's pages can live on disk. If the program touches one that is not in RAM, the processor raises a and hands control to the operating system, which loads the page and lets the program carry on.
Why bother? Memory used to be very expensive, so large programs had to carry their own code for juggling data between main memory and disk, a chore called . Virtual memory took that work off the programmers' plates, and it also brought isolation and security.
Step 1: Program touches a page
Not currently in RAM
Step 2:
The processor hands control to the operating system
Step 3: Page loaded
From disk into a free spot in RAM
Step 4: Instruction retried
The program carries on and never notices
1959
Working prototypes of
1962
First Atlas commissioned at Manchester
1964
Burroughs B5000: first commercial machine with virtual memory
1969
IBM team ends the debate: virtual memory beats manual control
Quiz me
0/3
Recap
Programs use virtual addresses; the memory management unit translates them to real ones, and a page fault pulls missing pages in from disk.
💡 A trick to remember it · A hotel where every guest is told 'room 1' and the front desk quietly sends them to different floors.
Surprising fact · An IBM team showed in 1969 that virtual memory beat the best hand-managed memory systems.
Sources (4)
No source, no claim. Every fact in this lesson (16 claims) cites at least one of these.