Second Chance Page Replacement Algorithm

Lists of Descriptive Questions Answers and Short Study Notes On Operating System – Second Chance Page Replacement Algorithm

  • (1) Explain The Second Chance Page Replacement Algorithm

 

Question-1 Explain The Second Chance Page Replacement 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. If the R bit is 1, the bit is cleared, the page is put onto the end of the list of pages, and its load
  • time is updated as though it had just arrived in memory. Then the search continues.
  • The operation of this algorithm is called second chance.

What second chance is doing is looking for an old page that has not been referenced in the previous clock interval. If all the pages have been referenced, second chance degenerates into pure FIFO.

Page replacement Algorithm fig-1

Figure –  Operation of second chance. (a) Pages sorted in FIFO order. (b) Page list if a page fault occurs at time 20 and A has its R bit set. The numbers above the pages are their loading times.