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

Logical Address Translation in Segmentation

Understanding how a logical address (segment number, offset) is translated to a physical address using the segment table.

Logical Address Translation in Segmentation

What You'll Learn

You'll learn how a segmentation-based memory management system converts a logical address (segment number plus offset) into a physical memory address using the segment table.

The Translation Process

In segmentation, a logical address consists of two parts:

  1. Segment number (s): Identifies which segment the address belongs to
  2. Offset (d): The distance from the beginning of that segment

Think of it like giving directions: "Go to Building 3 (segment), then walk 50 meters inside (offset)."

How Translation Works

When a program references a logical address <s, d>, the MMU performs these steps:

  1. Extract the segment number s from the logical address
  2. Index into the segment table using s to find the segment's entry
  3. Retrieve the segment's base address (where it starts in physical memory) and limit (its length)
  4. Validate that the offset d is less than the segment's limit (bounds checking)
  5. Calculate the physical address: physical_address = base + d

If the offset exceeds the limit, the system raises a segmentation fault to prevent illegal memory access.

Example

Suppose:

  • Logical address: <2, 100> (segment 2, offset 100)
  • Segment table entry 2: base = 4300, limit = 600

Translation:

  • Check: 100 < 600 ✓ (valid)
  • Physical address = 4300 + 100 = 4400

This protection ensures processes can't accidentally access memory outside their allocated segments.

Key Takeaway: Logical address translation in segmentation maps a <segment, offset> pair to a physical address by looking up the segment's base in the segment table, validating the offset against the segment's limit, and computing base + offset.