• ↑↓ to navigate
  • ↵ to open
  • ⟶ to select
  • ⌘ ⌥ ↵ to open in a panel
  • ←→ to navigate
  • esc to dismiss
⌘ '
keyboard shortcuts

Framing

Compare two memory management schemes: paging (fixed-size chunks) vs segmentation (variable-size logical units). Both enable virtual memory but with different trade-offs.

Comparison

FeaturePagingSegmentation
SizeFixed (e.g., 4KB pages)Variable (code, data, stack)
FragmentationInternal (last page wasted)External (gaps between segments)
AddressingPage number + offsetSegment number + offset
TablePage table (one per process)Segment table (base + limit)
SharingHarder (page-granularity)Easier (share entire segment)
ProtectionPer-page bitsPer-segment (code=read/exec, data=rw)
GrowthAutomatic (new pages)Explicit (segment grow/shrink)

Key Insights

  1. Paging eliminates external fragmentation but wastes space inside pages (internal fragmentation)
  2. Segmentation matches program structure (code, data, stack are natural segments) but causes external fragmentation
  3. Paging is transparent to the programmer; segmentation is visible (segment registers)
  4. Modern OSs combine both: outer segmentation (for protection) with inner paging (for no external fragmentation) — this is called paged segmentation
  5. x86 architecture uses paged segmentation: segment selector → linear address → page table → physical

Synthesis

No single scheme wins — paging solves fragmentation but loses program semantics; segmentation preserves semantics but fragments memory. The best systems (like modern x86) use both: segmentation for protection and logical structure, paging for efficient physical memory use.

Visual Explanation

paging_vs_segmentation A Paging Vs Segmentati Input B Paging Vs Segmentati Core Mechanism A->B triggers C Paging Vs Segmentati Output B->C produces

Semantic Network

semantic_paging_vs_segmentation THIS Paging Vs Segmentati REL1 Related Concept THIS--REL1 related REL2 Builds Into THIS--REL2 builds into

Connections