← 🧱 Memory Management
Subtopic 1 of 6

5.1Address binding and relocation

The idea

Address translation: a program uses logical addresses starting from 0; hardware adds a relocation (base) register and checks a limit register.

Think of it like this: Street numbers inside a block of flats: "flat 12" means different physical places depending on which building (base address) you are in.

Why it exists

It lets the OS place a process anywhere in memory and protects processes from each other.

How it works

  1. The CPU emits the logical address.
  2. The MMU compares it with the limit: if too large, trap.
  3. It adds the base register to get the physical address.
  4. Changing the base register relocates the whole process with no change to its code.

Worked example: Base 14000, limit 3000, logical address 2500

2500 < 3000 so it is legal. Physical address = 14000 + 2500 = 16500.

Now play with it

  • →Step through the flow.
  • →Think what happens with logical address 3500 (a trap).
Logical address·
Limit register3000
Relocation register14000
Physical address·
  • The CPU issues the logical address 2500.
  • The MMU compares it with the limit register: 2500 < 3000, so it is legal (otherwise a trap to the OS).
  • The MMU adds the relocation register: 14000 + 2500.
  • The physical address 16500 goes on the memory bus. The program never sees it.

Changing the base register moves the whole process without touching its code: that is why run-time binding allows compaction.

Check yourself

Which binding time lets the OS move a process while it runs?

Remember: Physical = base + logical, after checking logical < limit.
Exam notes (the dense version)

A program uses logical (virtual) addresses; the hardware (the MMU) turns them into physical addresses. Binding can happen at compile time (absolute code), load time (relocatable) or run time (needs hardware: a relocation (base) register plus a limit register for protection). The logical address space is what the program sees; the physical address space is real RAM. Dynamic loading and linking bring in routines only when needed.

Previous year questions: Memory Management (11)

PYQs are grouped by topic, so this is the full set for Memory Management; try the ones that match this subtopic. Open all 11 on the topic page.