Page Replacement Calculator
LRU evicts the page unused for the longest time: the classic 20-reference string with 3 frames causes 12 page faults (FIFO 15, Optimal 9).
12
- Hits
- 8
- Hit ratio
- 0.4
- Fault ratio
- 0.6
| Step | Page | Frame 1 | Frame 2 | Frame 3 | Result |
|---|---|---|---|---|---|
| 1 | 7 | 7 | – | – | FAULT |
| 2 | 0 | 7 | 0 | – | FAULT |
| 3 | 1 | 7 | 0 | 1 | FAULT |
| 4 | 2 | 2 | 0 | 1 | FAULT |
| 5 | 0 | 2 | 0 | 1 | hit |
| 6 | 3 | 2 | 0 | 3 | FAULT |
| 7 | 0 | 2 | 0 | 3 | hit |
| 8 | 4 | 4 | 0 | 3 | FAULT |
| 9 | 2 | 4 | 0 | 2 | FAULT |
| 10 | 3 | 4 | 3 | 2 | FAULT |
| 11 | 0 | 0 | 3 | 2 | FAULT |
| 12 | 3 | 0 | 3 | 2 | hit |
| 13 | 2 | 0 | 3 | 2 | hit |
| 14 | 1 | 1 | 3 | 2 | FAULT |
| 15 | 2 | 1 | 3 | 2 | hit |
| 16 | 0 | 1 | 0 | 2 | FAULT |
| 17 | 1 | 1 | 0 | 2 | hit |
| 18 | 7 | 1 | 0 | 7 | FAULT |
| 19 | 0 | 1 | 0 | 7 | hit |
| 20 | 1 | 1 | 0 | 7 | hit |
Step-by-step solution
- LRU replaces the page not used for the longest time
- 12 faults in 20 references
Page Replacement Formula
hit ratio = hits ÷ references
FIFO evicts the oldest, LRU the least recently used, Optimal the one used furthest ahead
Worked Example
The reference string 7 0 1 2 0 3 0 4 2 3 0 3 2 1 2 0 1 7 0 1 with 3 frames:
- LRU replaces the page not used for the longest time
- 12 faults in 20 references
Hit ratio: 0.4 · Fault ratio: 0.6
| Step | Page | Frame 1 | Frame 2 | Frame 3 | Result |
|---|---|---|---|---|---|
| 1 | 7 | 7 | – | – | FAULT |
| 2 | 0 | 7 | 0 | – | FAULT |
| 3 | 1 | 7 | 0 | 1 | FAULT |
| 4 | 2 | 2 | 0 | 1 | FAULT |
| 5 | 0 | 2 | 0 | 1 | hit |
| 6 | 3 | 2 | 0 | 3 | FAULT |
| 7 | 0 | 2 | 0 | 3 | hit |
| 8 | 4 | 4 | 0 | 3 | FAULT |
| 9 | 2 | 4 | 0 | 2 | FAULT |
| 10 | 3 | 4 | 3 | 2 | FAULT |
| 11 | 0 | 0 | 3 | 2 | FAULT |
| 12 | 3 | 0 | 3 | 2 | hit |
| 13 | 2 | 0 | 3 | 2 | hit |
| 14 | 1 | 1 | 3 | 2 | FAULT |
| 15 | 2 | 1 | 3 | 2 | hit |
| 16 | 0 | 1 | 0 | 2 | FAULT |
| 17 | 1 | 1 | 0 | 2 | hit |
| 18 | 7 | 1 | 0 | 7 | FAULT |
| 19 | 0 | 1 | 0 | 7 | hit |
| 20 | 1 | 1 | 0 | 7 | hit |
GATE tip
Count only the faults after the frames fill if the question says “excluding compulsory misses”; the table marks every fault so you can subtract the first ones.
More Operating Systems Calculators
-
CPU Scheduling Calculator
TAT = completion − arrival, WT = TAT − burst
response = first run − arrival
Example: Four processes arriving at 0, 1, 2 and 3 with bursts 8, 4, 9 and 5 under SRTF: Average waiting time = 6.5.
-
Paging Calculator
page table size = 2^(VA − offset) × PTE
EAT = h(t + m) + (1 − h)(t + 2m)
Example: A 32-bit virtual address, 4 KB pages and 4-byte page table entries: Page table size = 4194304 bytes.
-
Disk Scheduling Calculator
total movement = Σ |cylinderᵢ₊₁ − cylinderᵢ|
SCAN goes to the disk end; LOOK turns at the last request
Example: Requests 98, 183, 37, 122, 14, 124, 65, 67 with the head at 53 moving towards 0, SCAN: Total head movement = 236 cylinders.
-
Banker’s Algorithm Calculator
Need = Max − Allocation; run Pᵢ if Needᵢ ≤ Work
then Work = Work + Allocationᵢ
Example: Silberschatz’s five processes and three resource types with Available (3, 3, 2): State = safe, sequence ⟨P1, P3, P4, P0, P2⟩.
Frequently asked questions
What is Belady’s anomaly?
With FIFO, adding frames can increase faults: 1 2 3 4 1 2 5 1 2 3 4 5 gives 9 faults with 3 frames but 10 with 4. LRU and Optimal never show it.
Why is Optimal replacement not used in practice?
It needs future references; it serves as a lower bound to compare other algorithms against.
Sources
Last reviewed: . Factors are stored exactly and computed with 50-digit decimal arithmetic. See how we verify conversion factors.
Cite this page
APA
Scientific Converters. (2026, October 15). Page Replacement Calculator. Retrieved October 25, 2026, from https://scientificconverters.com/calculators/page-replacement-calculator/
IEEE
Scientific Converters, "Page Replacement Calculator," scientificconverters.com. Accessed: Oct. 25, 2026. [Online]. Available: https://scientificconverters.com/calculators/page-replacement-calculator/