Course contentsShow
← Computer Science
Lesson 1332 of 2,87231. Memory ManagementFree lesson

Base and Limit Registers

Study the simplest hardware mechanism for implementing address spaces using two registers to define a process's memory range.

Base and Limit Registers

What you'll learn: You'll discover the simplest hardware mechanism that lets multiple processes safely share memory by using just two special-purpose registers.

The Core Idea

When we create the abstraction of an address space for each process, we need hardware support to make it work safely. The base and limit register mechanism is the simplest approach: two registers in the CPU define the boundaries of a process's memory region.

  • Base register: Holds the starting physical address of the process's memory
  • Limit register: Holds the size (length) of the process's memory region

When a process generates a logical (virtual) address, the hardware automatically:

  1. Adds the base value to translate it to a physical address
  2. Checks that the address doesn't exceed the limit

If the address is out of bounds, a hardware exception (trap) occurs, preventing illegal memory access.

An Everyday Analogy

Think of a hotel hallway. Your reservation gives you room 205 (logical address 5), but the hotel's 2nd floor starts at physical room number 200 (base). The limit ensures you can only access rooms 200-210 on your floor—you can't wander into the 3rd floor's rooms.

How It Works

When Process A runs:

  • Base = 10000, Limit = 5000
  • Process tries to access address 100 → Physical address = 10000 + 100 = 10100 ✓
  • Process tries to access address 6000 → Exceeds limit (6000 > 5000) → TRAP!

During a context switch, the OS saves the current base/limit values and loads the new process's values.

Key Takeaway: Base and limit registers provide simple, fast address translation and protection by defining each process's contiguous memory range using only two hardware registers—the foundation of memory management hardware.