Skip to content
We areTOP 1%

What is the difference between a logical and a physical address, and what does the MMU do?

EasyConceptMemory Management
Track your progress
First attempt
Re-solve after a few days
Final pass before interviews

Answer

A logical address, also called a virtual address, is the address a program uses, generated by the CPU as it runs. A physical address is the real location of a byte in RAM. The Memory Management Unit (MMU) is the hardware that translates every logical address into a physical one at run time.

  • Programs are written as if they start at address 0, so the OS can load them anywhere in RAM and even move them later.
  • It provides protection: a process can only form addresses inside its own space, and any other access traps to the OS, which reports it, for example, as a segmentation fault.
  • In the simplest scheme, the MMU uses a base (relocation) register and a limit register; with paging, it uses a page table, with recent translations cached in the TLB.

Example: base = 14000 and limit = 3000. Logical address 346 is below the limit, so the physical address is 14000 + 346 = 14346. Logical address 3500 is not below 3000, so the MMU traps and the OS stops the process. Two processes can both use logical address 346 and still reach different physical bytes, because their base registers differ.

More in Memory Management

Sign in to track your progress

Your checkboxes, streak and activity heatmap are saved to your account and sync across devices. It is free.
Sign in with email

New here? Create an account