Page Replacement Algorithms
The page replacement algorithms actually elects which memory page is to be replaced. The replacement process is sometimes called as swap out/write to disk. Page replacement is done whenever the requested page is not-found in the main memory.
If the algorithm is not optimal?
- In case if the number of frames which are allotted to a process is not adequate or precise then there exist possibility of thrashing problem. Just because of lack of frames the most of the pages will be existing in the primary memory and thus more page faults will occur. But, if OS allots more frames to the process then there are more chances of internal-fragmentation.
- Uncertainty the page replacement algorithm is not optimal then there will also be thrashing problem. In case if the number of pages that are replaced by the requested pages would be referred in the nearby future then there will be additional number of swap-in and swap-out and then the OS has to perform additional replacements then usual which causes performance lack. As a result, the task of an optimal page replacement algorithm is to elect the page which can bound the thrashing.
Types of Page Replacement Algorithms
There are several page replacement algorithms while each and every algorithm has a different technique by which the pages can be replaced.
Algorithm | Description |
Optimal Page Replacement Algorithm | OPR algorithm replaces the page which would not be referred for so long in forthcoming. Even though it cannot be practically implementable but it can be used as a standard. |
Least-recent-used (LRU) Algorithm | LRU algorithm that changes the page which has-not been referred for a long-time. This algorithm is quite opposite to the OPR algorithm. |
FIFO | In this algorithm, a queue is maintained. The page that is assigned the first frame will be replaced first. Simply the page which exist at the rare end of the queue will be replaced on the every single page fault. |