Under a segmentation memory scheme, what two components make up a logical address?
AA page number and a physical frame number
BA segment number and an offset within that segment
CA base address and an effective address
DA virtual page and a dirty bit
Segmentation uses two-dimensional logical addresses: the segment number identifies which logical unit (code, stack, heap, etc.) is being accessed, and the offset specifies the position within that segment. The MMU looks up the segment number in the segment table to find the physical base address and the limit, checks that offset < limit, and computes the physical address as base + offset. This is what distinguishes segmentation from flat address spaces.
Question 2 Multiple Choice
After running many processes, a system using segmentation has 200 MB of free physical memory in total, but that free memory is scattered across small fragments between allocated segments. A process requests a single 150 MB contiguous segment. The allocation fails despite having enough free memory. What explains this?
ASegmentation does not support memory protection, so the allocation cannot be authorized
BEach segment must occupy a contiguous block of physical memory; fragmented free space cannot satisfy a large contiguous request even if the total free memory is sufficient
CThe segment table has a fixed maximum number of entries and is full
DThis situation is impossible — segmentation prevents external fragmentation by design
This is external fragmentation — the fundamental weakness of segmentation. Unlike paging, which uses fixed-size pages that can be placed anywhere, each segment must be contiguous in physical memory. Free memory scattered across many small gaps cannot be combined for a segment requiring a single large block. Option D is a common misconception: segmentation reduces but does not eliminate external fragmentation compared to single-block contiguous allocation, because it still requires each segment to be contiguous.
Question 3 True / False
Segmentation eliminates external fragmentation because the logical address space is divided into separate segments that can be independently placed in physical memory.
TTrue
FFalse
Answer: False
Segmentation reduces granularity compared to allocating one contiguous block per process, but it does not eliminate external fragmentation. Each individual segment still requires a contiguous region in physical memory. Over time, as segments are created and destroyed, free memory becomes scattered into gaps that may each be too small for a new large segment — external fragmentation. This limitation is precisely why modern systems moved to paging, which uses fixed-size pages that eliminate external fragmentation entirely.
Question 4 True / False
A segmentation fault is generated by the MMU when a program's memory access uses an offset that exceeds the segment's limit field.
TTrue
FFalse
Answer: True
The hardware segment table stores both a base (physical start address) and a limit (maximum valid offset) for each segment. On every memory access, the MMU compares the offset portion of the logical address against the limit. If offset ≥ limit, the access is invalid and the hardware generates a trap — historically called a segmentation fault. On modern paging systems, 'segmentation fault' is used more loosely to mean any invalid memory access, but the origin of the term is precisely this segment-limit check.
Question 5 Short Answer
How do the base and limit fields in a segment table entry work together to both translate addresses and enforce memory protection, and what happens when an illegal access is attempted?
Think about your answer, then reveal below.
Model answer: Each segment table entry contains two fields: base (the physical address where the segment starts) and limit (the maximum valid offset within the segment). When a program accesses a logical address (segment number, offset), the MMU performs two operations: first, it checks that offset < limit — if not, it generates a hardware trap (segmentation fault) and the access is denied. Second, if the check passes, the physical address is computed as base + offset. This two-step process simultaneously provides address translation (logical → physical) and protection (preventing access beyond the segment boundary). Additional protection bits (read-only, execute-only) can be stored per segment table entry to enforce finer-grained access policies.
The separation of base and limit also enables sharing: two processes can have segment table entries with the same base but different limits, or identical base and limit entries pointing to the same shared library. Protection faults from the limit check are what stop buffer overflows that exceed a segment's bounds — one of segmentation's original security motivations.