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:
- Segment number (s): Identifies which segment the address belongs to
- 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:
- Extract the segment number
sfrom the logical address - Index into the segment table using
sto find the segment's entry - Retrieve the segment's base address (where it starts in physical memory) and limit (its length)
- Validate that the offset
dis less than the segment's limit (bounds checking) - 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.