Sunday, August 22, 2021

LRU Page Replacement Algorithm | What is page replacement algorithm? | Why page replacement algorithm is used? | LRU Page replacement algorithm example

 

LRU Page Replacement Algorithm

Page replacement algorithm are needed to decide which page to be replaced when new page comes in main memory. Page Fault – A page fault occurs when a program attempts to access a block of memory that is not stored in the physical memory, or RAM. Different page replacement algorithms are: FIFO, LRU, Optimal. The target for all algorithms is to reduce number of page faults.

LRU Stands for Least Recently Used. In Least Recently Used (LRU) algorithm is a Greedy algorithm where the page to be replaced is least recently used.  The LRU algorithm can be implemented by associating a counter with every page that is in main memory. When a page is referenced, its associated counter is set to 0. At fixed intervals of time, the counters associated with all pages presently in memory are incremented by 1. The least recently used page is the page with the highest count. The counters are often called aging registers, as their count indicates their age, that is, how long their associated pages have been referenced.



Advantages

Performance of LRU is high in compare to FIFO.

Disadvantage

Maintain a counter for each page.


To learn more about LRU Page Replacement Algorithm, watch below video



Video : LRU Page Replacement Algorithm

Watch more videos click here.

No comments:

Post a Comment