Explain like I'm five · Systems

What is Paging and Segmentation?

Paging and segmentation, told as a story about whether to cut the parts-warehouse shelf into equal slots or by what each part is for.

the parts-warehouse shelfF0F1F2F3blueprint bundlethis blueprint bundle is way bigger than one slotevery shelf slot is the same size, but work items come in every sizethe puzzle: what size to cut memory (the shelf) into

Every shelf slot is the same size, but work items come in every size.The puzzle: what size to cut memory (the shelf) into.

a small part leaves empty room in its slotblueprint 1blueprint 2blueprint 3a big blueprint bundle gets split across slotswhat happens with same-size slots onlyscraps of space stay empty, and one big item gets cut into pieces

With same-size slots only, small items leave empty room and big ones get cut across slots.Same-size slots are easy to manage, but they don't fit the shape of the items.

paging cuts the shelf into equal slots; segmentation cuts it by usepaging: all the same sizeP0P1P2P3contents don't mattersegmentation: by use, each its own sizecodedatastacklike blueprints, parts, and the temp tableboth turn a virtual address into a real memory location

Paging cuts memory into equal slots; segmentation cuts it by use.Both turn a virtual address into a real memory location.

Paging — same sizefound by page number and position inside it
Segmentation — by usedivided into code, data, and stack
Both use a lookup tableturns a virtual address into a real location
Sometimes mixedeach segment is cut again into pages
PAGINGcut into same-size pagessplit by size alonescraps inside slots (internal fragmentation)SEGMENTATIONcut into segments by useeach a different sizegaps between chunks (external fragmentation)codestackdatagapgapa hybrid also exists: segments cut again into same-size pages

Paging leaves scraps inside slots; segmentation leaves gaps between chunks.A hybrid also exists: segments cut again into same-size pages.

PAGE TABLEP0 → F7P1 → F2P2 → F5location: one frame number per pagesame-size slots, so no length is listedSEGMENT TABLEcode: start 100, length 40data: start 300, length 25stack: start 500, length 15sizes vary, so start and length are both listedan address past the length gets blockedthe address lookup and page faults are on the virtual-memory page

For location, a page table needs only a frame number; a segment table needs start and length.The address lookup and page faults are on the virtual-memory page.

In one breath

Paging cuts memory into same-size slots, while segmentation cuts it by use (code, data, stack, and so on) — two ways of turning a virtual address into a real memory location.

Paging divides both virtual and physical memory into fixed-size chunks (pages/frames) matched through a page table — simple to implement, with no external fragmentation, though a partly filled last page wastes space (internal fragmentation). Segmentation divides a program into meaningful units (code, data, stack) and records each one's start and length in a segment table. Units that match meaning make protection and sharing easier, but their varied sizes can leave gaps between segments (external fragmentation). Systems such as Multics and 32-bit x86 combined segments with paging; modern 64-bit operating systems rely mostly on paging.

When grown-ups say it

Paging
Cutting memory into same-size slots. Splits by size alone, whatever's inside.
Segmentation
Cutting memory by use. The code, data, and stack zones are covered here. → the rule for dividing the workspace into zones
Internal Fragmentation
Leftover space wasted inside a fixed-size slot. Occurs in paging.
External Fragmentation
Unusable gaps left between chunks. Common in segmentation.
Page Table
The table matching virtual pages to real frames. The core structure of paging. → the fake map that makes the whole warehouse mine
Segment Table
The table recording each segment's start and length. Blocking addresses past the length also gives protection.
Segmented Paging
A hybrid that cuts each segment again into pages. Segments handle protection and sharing; pages avoid external fragmentation.
Virtual Memory
A fake map that shows each process memory as its own private space. Paging and segmentation are two ways to build this map. → the fake map that makes the whole warehouse mine
Next story
Who Gets the Lift First →
Want another term as a picture book? Request →