Memory Management & Paging

The OS maps logical addresses to physical memory. Paging splits memory into fixed-size frames to remove external fragmentation.

Cheat sheet

  • ▸Logical address = page number + offset; page table maps page → frame.
  • ▸TLB caches recent page-table entries to speed translation.
  • ▸Paging → no external fragmentation, small internal fragmentation.
  • ▸Segmentation → variable-sized logical units, external fragmentation.
  • ▸Allocation strategies: First fit, Best fit, Worst fit.
  • ▸Effective Access Time = h×(TLB + mem) + (1−h)×(TLB + 2×mem).

Paging vs Segmentation

AspectPagingSegmentation
Unit sizeFixed (pages)Variable (segments)
FragmentationInternalExternal
Visible to programmerNoYes (code, stack, data)
TablePage tableSegment table (base, limit)

Visual

Logical addr [ page p | offset d ]
                   │
            Page table[p] = frame f
                   ▼
Physical addr [ frame f | offset d ]

Top 10 campus interview questions

Quick quiz

1. Paging suffers from:

2. TLB is a:

3. Page size 4 KB → offset bits:

4. Segmentation causes:

5. Compaction solves: