Page Replacement Algorithm

Page replacement algorithm is the logic or the policy regarding how to select a page to be swapped out from the main memory to create space for the page that has caused a page fault.

FIFO :- First In First Out its is simplest page replacement algorithm and associates with each page the time when that page was brought into memory. In this algorithm, when ever a page is to be replaced. The oldest page is chosen i.e. that page is swapped out, which has been in the main memory for the longest period of time.

SC :- Second Chance page replacement algorithm is a combination of the FIFO and NRU algorithm. In this algorithm, the page present for the longest time in the memory is given second chance to remain locked in the main memory.

LUR :- Last Recently Used algorithm used information about the page accessed in resent past to predict the near future. In this algorithm, whenever a page is to be replaced, we select the page that has not been used for the longest period of time.

OPT :- Optimum page replacement algorithm is considered the bast page replacement algorithm is a virtual memory theoretically but is difficult to implement. This algorithm is also called OPT or MIN. In this algorithm, we replace the page that will not be referred to for the longest period of time.

LFU :- Last Frequently Used page replacement algorithm is approximation of LRU algorithm. A page is to be replaced, that page is chosen that least frequently used or last intrusively referenced i.e the page with smallest count is replaced. This algorithm is expensive to implement and does not approximate OPT page replacement.