OPTIMAL

Downward Arrow

About

Optimal

Optimal Page Replacement algorithm is the best page replacement algorithm as it gives the least number of page faults. In this algorithm, pages are replaced which would not be used for the longest duration of time in the future, i.e., the pages in the memory which are going to be referred farthest in the future are replaced.


Advantages

  1. Easy to Implement.

  2. Simple data structures are used.

  3. Highly efficient.

Disadvantages

  1. Requires future knowledge of the program.

  2. Time-consuming.

Algorithm

  1. If referred page is already present, increment hit count.

  2. If not present, find if a page that is never referenced in future. If such a page exists, replace this page with new page.

  3. If no such page exists, find a page that is referenced farthest in future. Replace this page with new page.

Implementation

Reference String:
Frames: