Page Replacement Algorithm Calculator for FIFO, LRU, Optimal, and Clock
Use this page replacement algorithm calculator to solve operating-system memory management problems without drawing every frame by hand. It supports FIFO, LRU, Optimal, Clock, LFU, and LIFO, then shows page faults, hits, hit rate, miss rate, and the full frame table.
Paste a reference string such as 7 0 1 2 0 3 0 4 and choose the number of frames.
Compare all algorithms in one table to see which one gives the lowest page fault count.
Review every step with frames, hit or fault status, evicted page, and the reason for replacement.
Lower page faults usually mean better performance for the same reference string and frame count.
Algorithm
Page Faults
Hits
Hit Rate
Miss Rate
FIFOFirst In First Out
10
3
23.08%
76.92%
LRULeast Recently Used
9
4
30.77%
69.23%
OptimalOptimal Page Replacement
7
6
46.15%
53.85%
ClockSecond Chance / Clock
9
4
30.77%
69.23%
LFULeast Frequently Used
8
5
38.46%
61.54%
LIFOLast In First Out
9
4
30.77%
69.23%
Step-by-step calculation
Frame state after each reference using FIFO.
Step
Page
Frame 1
Frame 2
Frame 3
Result
Evicted
Reason
1
7
7
-
-
Fault
-
Free frame available, so 7 is loaded without evicting another page.
2
0
7
0
-
Fault
-
Free frame available, so 0 is loaded without evicting another page.
3
1
7
0
1
Fault
-
Free frame available, so 1 is loaded without evicting another page.
4
2
2
0
1
Fault
7
7 entered memory first, so FIFO evicts it.
5
0
2
0
1
Hit
-
0 is already in memory, so this reference is a hit.
6
3
2
3
1
Fault
0
0 entered memory first, so FIFO evicts it.
7
0
2
3
0
Fault
1
1 entered memory first, so FIFO evicts it.
8
4
4
3
0
Fault
2
2 entered memory first, so FIFO evicts it.
9
2
4
2
0
Fault
3
3 entered memory first, so FIFO evicts it.
10
3
4
2
3
Fault
0
0 entered memory first, so FIFO evicts it.
11
0
0
2
3
Fault
4
4 entered memory first, so FIFO evicts it.
12
3
0
2
3
Hit
-
3 is already in memory, so this reference is a hit.
13
2
0
2
3
Hit
-
2 is already in memory, so this reference is a hit.
Page replacement guide for operating systems students
Learn how page faults, hits, frames, and replacement rules are calculated for common OS algorithms.
Calculate FIFO, LRU, and Optimal page replacement
FIFO evicts the oldest loaded page, LRU evicts the page that has not been used for the longest time, and Optimal evicts the page whose next use is farthest in the future. The calculator runs each rule against the same reference string so the page fault counts are easy to compare.
Use the step table to check homework answers
Each row shows the requested page, frame contents after the reference, whether it was a hit or page fault, the evicted page, and the replacement reason. That makes it easier to find exactly where a manual calculation went wrong.
Compare hit rate and miss rate
The hit rate is hits divided by total references, while the miss rate is page faults divided by total references. These metrics help compare algorithms beyond just counting faults.
Practice Clock, LFU, and LIFO too
Many examples focus only on FIFO, LRU, and Optimal, but operating-system classes may also discuss Second Chance or Clock, Least Frequently Used, and Last In First Out. This tool includes those modes for broader practice.
How to calculate page replacement algorithms online
Follow these steps to calculate page faults and compare page replacement algorithms.
Enter the page reference string
Paste or type the sequence of page references separated by spaces, commas, or semicolons.
Choose the number of frames
Set how many memory frames are available for the simulation.
Select an algorithm
Choose FIFO, LRU, Optimal, Clock, LFU, or LIFO to see the matching step-by-step calculation.
Compare page faults and hit rate
Use the comparison table to see page faults, hits, hit rate, and miss rate for every supported algorithm.
Page Replacement Algorithm Calculator FAQ
Quick answers about FIFO, LRU, Optimal, Clock, page faults, and hit rate calculations.
What is a page replacement algorithm calculator?
It is a tool that simulates how an operating system decides which memory page to evict when a new page is requested and all frames are full.
Which page replacement algorithms are supported?
This calculator supports FIFO, LRU, Optimal, Clock or Second Chance, LFU, and LIFO.
How do I enter the reference string?
Type page references separated by spaces, commas, or semicolons, such as 7 0 1 2 0 3 0 4.
What is a page fault?
A page fault happens when the requested page is not currently loaded in the available frames, so the algorithm must load it and may need to evict another page.
Why does Optimal usually have the fewest page faults?
Optimal chooses the page that will be used farthest in the future, so it has perfect future knowledge. Real systems cannot normally implement it, but it is useful as a benchmark.
Can FIFO have more page faults when frames increase?
Yes. FIFO can show Belady's anomaly, where adding more frames causes more page faults for some reference strings.