Page Replacement Algorithms
Pick any page replacement algorithm to simulate
First-In First-Out
This is the simplest page replacement algorithm. In this algorithm, operating system keeps track of all pages in the memory in a queue, oldest page is in the front of the queue. When a page needs to be replaced page in the front of the queue is selected for removal.
Least Recently Used
In Least Recently Used (LRU) algorithm is a Greedy algorithm where the page to be replaced is least recently used. The idea is based on locality of reference, the least recently used page is not likely.
Most Recently Used
In Most Recently Used (MRU) algorithm the page to be replaced is most recently used. It is the opposite of LRU.
Least Recently Used
This algorithm targets the page that won't be used for the longest time. It requires the OS to have information about the incoming requests beforehand.
Second Chance Algorithm
The Second Chance Page Replacement Algorithm. A simple modification to FIFO that avoids the problem of throwing out a heavily used page is to inspect the R bit of the oldest page.
If it is 0, the page is both old and unused, so it is replaced immediately.
Comparison of Algorithm
In this simulation First-In First-Out, Least Recently Used, Most Recently Used, Optimal Page Replacement and Second Chance Algorithm are compared
A graph is then generated comparing the page faults occuring in each algorithm.