Page Replacements in Operating System

In the previous tutorial, we have learned about paging and Segmentation. Now we are going to learn about page replacements in operating system and what are the different strategies we can apply.

When a page fault occurs, the memory manager locates the page in secondary storage. Then it will load it into main memory and update the page table entry.

Page Replacement Strategies :

Any page replacement strategy is characterized by the scheme it uses to replace any page. We will discuss some of the most known page replacements in operating system.

FIFO Page Replacement :

First in first out (FIFO) page replacement algorithm replaces the page that is there in the system for the longest time. FIFO is impractical for most real life problems. When number of page frames increases, for certain page requests number of faults also increases. We call it Belady ’s (or FIFO) Anomaly.

LRU Page Replacement :

Least recently used page replacement algorithm replaces the page that is there in the system for the longest time without being referenced. A page that we reference heavily in the past may be we never reference again. But will stay in memory.

NUR Page Replacement :

Not used recently (NUR) page replacement algorithm is basically a modified version of LRU page replacement algorithm. Here, we use referenced bit and modified bit to determine which page we have not been used recently. Then we can replace quickly.

Second Chance Page Replacement :

This strategy is the modified version of FIFO page replacement algorithm. It checks the reference bit of the oldest page, if it is off then the algorithm replaces it. On the other hand, if it is on then we will turn it off and moves it to tail of the FIFO queue.

Optimal Page Replacement :

This algorithm obtains optimal performance. It replaces the page that we will not reference again until the furthest into the future. But we can not implement optimal page replacement algorithm in real systems.

Global vs. Local Page Replacement

We apply global page replacement algorithms to all processes as an unit. This generally ignores the individual characteristics of process behavior. On the other hand, local page replacement algorithms consider each process individually.