This project simulates three popular page replacement algorithms used in operating systems to manage memory efficiently:
- FIFO (First In, First Out): Removes the oldest page in memory.
- LRU (Least Recently Used): Removes the page that hasn't been used for the longest time.
- Optimal: Removes the page that won't be used for the longest time in the future (ideal but impractical).
The simulator compares their performance by calculating:
- Page Hits: Number of times a page was found in memory, meaning we don’t have to fetch it from the hard disk.
- Page Faults: Number of times a page was not found, requiring replacement, meaning we had to go fetch it from the hard disk.
- Hit Ratio and Fault Ratio.
- Configure frame size (memory capacity) to test algorithm behavior under different conditions.
- Display step-by-step progression of frames for each algorithm.
- Compare all three algorithms in a structured summary.
- Input Parameters:
- Page sequence and frame size.
- Simulation:
- The program applies the algorithms to the page sequence.
- Output:
- A detailed breakdown of frame states and a comparison table of performance metrics.
- Install Python: Make sure you have Python installed on your machine. You can download it from python.org. Ensure that you install Python 3.11.
- Clone the Repository: Open your terminal and run the following code.
git clone https://github.com/NeilNeel/Page-Replacement-Algorithm.git
- Navigate to the Project Directory
cd Page-Replacement-Algorithm
- Run the Program
python main.py