Chapter 9 · Simulation

Page Replacement

← Chapter 9
Frames 3
Speed 1.5/s

✗ Faults 0 ✓ Hits 0 Hit rate – Step 0/0

Page Replacement

A process accesses pages in the order of the reference string. If the page is already in a frame, this is a hit; otherwise a page fault occurs and the page is loaded into memory. When all frames are full, the replacement algorithm picks the victim page to evict. The grid shows the frames after each reference; the strip below shows the algorithm state (which page is next to be evicted).

Usage

  • Choose an algorithm and a number of frames (1–8).
  • Type a reference string (up to 40 pages separated by spaces) or pick a preset.
  • Play, step through, or click a reference in the top row of the grid to jump to that step.
  • Compare shows the page faults of all algorithms and FIFO’s fault counts for 1–6 frames (Belady’s anomaly).

Algorithms

FIFO
The page loaded first is evicted.
OPT
The page used furthest in the future is evicted (requires knowing the future; a lower bound on faults).
LRU
The least recently used page is evicted.
LFU
The page with the lowest count is evicted; ties go to the least recently used. The count resets when a page is evicted.
Clock
If R=1, the bit is cleared and the page is skipped (second chance). The first page with R=0 is evicted. A newly loaded page gets R=1.

Legend

✓ hit ↓ loaded (fault) next to be evicted ↑7 evicted

Badges

#1
Position in the FIFO queue (1 = oldest)
−2
LRU: last used 2 steps ago
×3
LFU: reference count
+4
OPT: next used in 4 steps (∞: never)
R1
Reference bit in the clock algorithm

Keys

←→ stepSpace playHomeEnd first / lastEsc close