Optimal Page replacement Memory Management Operating Systems OS

Optimal Page replacement Memory Management Operating Systems OS

According to Optimal Page replacement OS replaces the page from the memory that is not used for a long period of time.

optimal page replacement algorithm operating systems
Figure: optimal page replacement algorithm operating systems

PF stands for a page fault  Read More  . FH is used in a table to represent the page hit.  Read More 

1st column: First of all, all memory is free.

2nd column: Page 4 is loaded on memory. A page fault  Read More   occurs because page 4 is already not on memory.

3rd column: Page 6 is loaded on memory. A page fault occurs.

4th column: Page 8 is loaded on memory. A page fault occurs.

5th column: Page 4 is already loaded on memory. No page fault.

6th column: Page 2 is loaded on memory. A page fault occurs.

7th column: Page 6 is already loaded on memory. No page fault.  Read More 

C++ program to demonstrate the Optimal Page Replacement Algorithm

Output

optimal page replacement program in c++
Figure: optimal page replacement program in c++.