Hello everyone, I hope y'all having a great day over there? Well, today I will writing on Page Fault and the various page replacement algorithms. In my previous post, I wrote about memory swapping and memory paging. I explained how the computer system is programmed to manage and share its memory to processes that that need it.
I made mention that...
Memory Swapping is a memory management technique used by the Operating System to move or swap temporary processes from the main or primary memory (RAM) to the secondary memory (Hard Disk) in order to provide more memory to other running processes.
I also said that
Memory Paging is another memory management technique used by the Operating System to read and write data from the secondary memory (Hard Disk) to the main or primary memory (RAM).
More of this information can be found here. https://steemit.com/hive-181430/@vectorshore/siz-education-memory-swapping-and-paging-or-20-post-payout-to-siz-official-or-by-vectorshore
So today, I'll be writing on what page fault is and the various types of page replacement algorithms.
WHAT IS PAGE FAULT?
A page fault is an error that occurs when a page that is not in the computer memory is requested. This error occurs on computer operating systems that use paging for their virtual memory management.
In a situation where a page fault occurs, the Operating System (OS) has to replace that page with another existing page, hence the need for page replacement algorithms.
Page Replacement Algorithms
- Optimal Page Replacement Algorithm:
In this algorithm, pages are labeled with the number of instructions that will be executed before that page is first referenced.
This algorithm simply states that the page with the highest label should be removed and replaced with the one with which reference is longest.
- Next Recently Used Page Replacement Algorithm (NRU):
In this algorithm, a random page is removed from the lowest numbered non-empty class. It clearly states that it is better to use a page that has not been referenced than to use a clean page that's in heavy use.
- The First In First Out Page Replacement Algorithm (FIFO):
In this algorithm, the Operating System holds a list of all pages currently in the memory. When a page fault occurs, the page at the head is removed and the new page is added to the end of the list.
This algorithm selects a page for replacement that had been in the memory for a the longest time.
- Clock Page Replacement Algorithm:
In this algorithm, all the pages are kept in a circular list in a clock form with a hand pointing to the oldest page. The page pointed by the hand is inspected when a page fault occurs.
- Least Recently Used Page Replacement Algorithm:
When a page fault occurs, the page that is not used for the longest time is thrown out.
In my next post, I will be writing on another computer memory management technique known as Segmentation. I hope you like my contents. Thank you for stopping by and for your continuous support.