Detailed Note

OS — Paging & Page Replacement

Author-reviewed original note · English below, Hindi summary in the note text where provided.

~7 min read

Paging

Paging splits memory into fixed-size frames and processes into pages. No external fragmentation — like a hostel where every room is the same size, so any student fits any free room.

Page replacement

  • FIFO: Evict the oldest page. Simple, can suffer Belady's anomaly.
  • LRU: Evict the least recently used page. Good, needs hardware support.
  • OPT: Evict the page used farthest in future. Optimal, but needs future knowledge — a benchmark, not a real policy.

Worked example

Pages 1,2,3,4,1,2,5 with 3 frames under FIFO = 7 faults (see seed question cs-04).