Segmentation with Paging (Hybrid Approach)
What you'll learn: How modern operating systems combine segmentation and paging to gain the logical organization benefits of segments while eliminating external fragmentation.
The Best of Both Worlds
After learning the trade-offs between segmentation and paging, you might wonder: why not use both? That's exactly what many systems do! In a hybrid approach, the logical address space is first divided into segments (code, stack, heap), but then each segment is divided into fixed-size pages.
How It Works
Think of it like organizing a library: segments are like sections (Fiction, Reference, History), and pages are like standardized shelf units within each section. You get meaningful organization and uniform storage.
Here's the two-level translation:
- Logical address contains:
<segment number, offset within segment> - The segment table entry points to a page table for that segment (not directly to physical memory)
- The offset is divided into:
<page number, page offset> - The segment's page table translates the page number to a frame number
- The frame number + page offset gives the physical address
Benefits Combined
- Logical division: Programs still see meaningful segments with separate protection and sharing per segment
- No external fragmentation: Each segment is paged, so memory is allocated in fixed-size frames
- Flexible segment sizes: Segments can grow by allocating more pages without worrying about finding contiguous space
- Fine-grained memory management: Unused portions of segments don't waste frames
The Cost
Translation becomes more complex (two table lookups), but TLBs help cache these translations efficiently.
Key Takeaway: Segmentation with paging combines logical address organization from segmentation with the physical memory management advantages of paging, eliminating external fragmentation while preserving segment-level protection and sharing.