How an operating system lets a dozen programs, each written as if it owned all of memory, actually share a fixed amount of RAM safely. Every diagram below is a real, live picture of memory, not a description of one.
On the left, a program's virtual pages. On the right, actual physical RAM frames. The lines between them are the page table, made visible. Translate an address and watch the exact page, line, and frame light up.
Rather than fixed-size pages with no relationship to the program's structure, segmentation divides memory along logical lines the programmer actually recognises: code, data, stack.
| Property | Paging | Segmentation |
|---|---|---|
| Block size | Fixed (e.g. 256 bytes) | Variable, matches logical units |
| Fragmentation risk | Internal (last page often part-empty) | External (gaps between variable blocks) |
| Programmer awareness | Invisible to the programmer | Can reflect the program's own structure |
| Address form | Page number + offset | Segment number + offset |
RAM can't hold every page at once. When it's full and a new page is needed, something has to be evicted, watch it happen, not just read about it.
Three processes, 8 virtual pages between them, but only 4 physical frames exist. Click any page to access it. Watch RAM genuinely fill up, and watch exactly which page lands in secondary storage the moment something has to move out.