|
MFU Algorithm is a Page Replacement Algorithm in the Operating System that replaces the page accessed a maximum number of times in the past. If more than one page is accessed the same number of times, then the page which occupied the frame first will be replaced. Page ReplacementIt is a technique of replacing a data block (frame) of Main Memory with the data block (page) of Secondary Memory when all the frames of Main Memory are occupied and CPU demands for the data block which is not available inside Main Memory, technically, when Page Fault occurs. Example: Consider a Main Memory with a number of frames = 4 and the following are the data block access requests made by the CPU.
Given, the number of frames = 4. Initially, all are empty Page Replacement Using the Most Frequently Used (MFU) Algorithm(i) The 4 frames are initially empty, the first 4 blocks occupy them.
First four blocks occupy the 4 frames (ii) Block 0 has already occupied the frame.
(iii) Block 0 is accessed maximum times, so replaced with incoming Block 3.
Block 0 replaced with Block 3 (iv) Blocks 2,1,3,7 are accessed once and Block 7 occupied the frame first, so, Block 7 replaced with incoming Block 0.
Block 7 replaced with Block 0 (v) Block 0 is accessed maximum times so replaced with incoming Block 4.
Block 0 replaced with Block 4 (vi) Blocks 2,3 have already occupied the frame.
(vii) Block 2 and Block 3 are accessed maximum times and Block 2 occupied the frame first, so, Block 2 replaced with incoming Block 0.
Block 2 replaced with Block 0 (viii) Block 3 has already occupied the frame.
(ix) Block 0 is accessed maximum times so replaced with incoming Block 2.
Block 0 replaced with Block 2 (x) Block 1 has already occupied the frame.
![]() Final Image ConclusionAll the data block access requests made by CPU are completed using Most Frequently Used (MFU) Algorithm. In this algorithm, as most frequently accessed page is replaced, this increases the number of Page Faults. Number of Page Faults for above example are 5+4 = 9 page faults. Frequently Asked QuestionsQ.1: What is a data block in Operating System?Answer:
Q.2: What is a Frame and a Page in Operating System?Answer:
Q.3: What is a Page Fault in Operating System and why does it occur?Answer:
Q.4: How does Operating System deals with Page Fault?Answer:
Q.5: Other than Most Frequently Used (MFU) Algorithm, what are some other Page Replacement Algorithms in Operating System?Answer:
|
Reffered: https://www.geeksforgeeks.org
Operating Systems |
Type: | Geek |
Category: | Coding |
Sub Category: | Tutorial |
Uploaded by: | Admin |
Views: | 17 |