Main Memory: Allocation, Linking & Segmentation

a logical address

Suppose every actor in a play gets a script numbered from page 1, no matter which theatre they perform in. Inside the script, 'turn to page 40' always means the same thing, even though the physical seat numbers in the building have nothing to do with those page numbers. A logical address is like that page number: it is the address a program uses inside its own private world, counted as if the program started at zero, independent of where it really sits in physical memory.

Concretely, when your code does something like 'load the value at address 1000', that 1000 is a logical address — generated by the CPU as it runs the program. It is not (in general) the actual location in the RAM chip. Before the access can happen, that logical address must be turned into a physical address by a piece of hardware as the instruction executes. In the simplest scheme, the translation is just an addition: physical = logical + base, where base is where the program was actually placed. The full set of logical addresses a program can produce is called its logical (or virtual) address space.

Why it matters: this separation is the key idea that lets many programs coexist. Each program can be written and compiled as if it owns memory starting at zero, while the OS quietly places different programs in different physical spots. The program never needs to know — or care — where it really lives. The terms 'logical address' and 'virtual address' mean the same thing in nearly all modern systems.

Two copies of the same calculator program both reference logical address 0 for their first instruction. The OS placed copy A at physical 5000 and copy B at physical 90000, so copy A's logical 0 becomes physical 5000 and copy B's becomes physical 90000 — no clash.

Identical logical addresses can map to completely different physical locations.

If a program were bound to physical addresses at compile time, you could not relocate it freely or run two copies at once. The logical/physical split is exactly what buys that freedom.

Also called
virtual address虛擬位址