External Fragmentation in Segmentation
What you'll learn: Why variable-sized segments create scattered free memory holes that can't be used efficiently, even when total free space is sufficient.
The Problem with Variable Sizes
In segmentation, each segment (code, stack, heap, data) has its own size based on actual needs—which sounds efficient! However, as processes are created and terminated over time, segments of different sizes come and go from physical memory. This leaves behind "holes" of free memory scattered throughout RAM.
External fragmentation occurs when you have enough total free memory to allocate a new segment, but no single contiguous block is large enough. The free space is fragmented into unusable pieces.
A Simple Analogy
Imagine a parking lot where vehicles of different sizes (motorcycles, cars, trucks) come and go throughout the day. After hours of activity, you might have plenty of empty spaces total—but they're scattered: a motorcycle-sized gap here, a car-sized gap there. When a bus arrives needing 4 consecutive spaces, it can't park even though 6 total spaces are empty across the lot.
Why This Matters
External fragmentation degrades performance over time because:
- Allocation failures happen even when sufficient total memory exists
- Memory compaction (moving segments to consolidate free space) is expensive and requires updating segment tables
- The system must either reject new processes or perform costly reorganization
- Memory utilization drops as usable space becomes trapped in small holes
Unlike internal fragmentation in paging (wasted space within a fixed-size frame), external fragmentation wastes space between variable-sized allocations.
Key Takeaway: External fragmentation is the natural consequence of allocating variable-sized segments—free memory becomes scattered into holes too small to use, forcing expensive compaction or wasted capacity.