Skip to content

Latest commit

 

History

History

MFU Page Replacement Algorithm

This program implements the FIFO (First-In-First-Out) Page Replacement Algorithm. The FIFO Page Replacement Algorithm is a simple paging algorithm where the page that entered the memory first is evicted first when the memory is full. This algorithm is based on a queue data structure. It maintains a queue of pages with a specified capacity and keeps track of page faults.

Usage

  1. Compile and run the program.
  2. Enter the maximum number of pages that can be held in memory when prompted.
  3. Enter the page numbers that need to be accessed (enter -1 to terminate).
  • Or you can directly use the (.exe) file that is available in the (Executable File) folder.

Example

                    ***********************************************************************************
                    *** Enter the maximum number of pages that can be held in memory: 3
                    ***********************************************************************************                                     
                    *** Enter the page numbers (enter -1 to terminate): 1 2 3 4 1 2 5 -1
                    ***********************************************************************************
                     ---> Page 1 is loaded into memory.
                    ***********************************************************************************
                     ---> Page 2 is loaded into memory.
                    ***********************************************************************************
                     ---> Page 3 is loaded into memory.
                    ***********************************************************************************
                     ---> Page 4 is evicted from memory.
                    ***********************************************************************************
                     ---> Page 1 is already in memory.
                     ---> Page 2 is already in memory.
                    ***********************************************************************************
                     ---> Page 5 is loaded into memory.
                    ***********************************************************************************

                     ---> Total Page Faults: 3
                    ***********************************************************************************

Files

  • main.cpp: A sample program that uses the FIFO page replacement algorithm.

  • PageReplacement.h: Contains the declaration of the abstract base class PageReplacement, which represents a page replacement algorithm.

  • PageReplacement.cpp : Implements the functionality of the PageReplacement class.

  • FIFO_PageReplacement.h: The header file for the FIFO_PageReplacement class, which derives from the PageReplacement class.

  • FIFO_PageReplacement.cpp: he implementation of the FIFO page replacement algorithm in the FIFO_PageReplacement class.

  • Object File : Contains the machine code of the program and the necessary information for linking.

  • Executable File : Contains the .exe file as the program's executable file.

  • Feel free to explore the code and make any modifications or improvements as needed.

References

BOOK:

  • Modern Operating Systems Book by Andrew Tanenbaum.
  • Operating System Concepts Book by Abraham Silberschatz.