A Java implementation and comparison of several page replacement algorithms used in operating systems memory management.
The program simulates how different algorithms handle page faults when managing a limited number of memory frames.
This project was created as part of a Operating Systems course.
The following page replacement algorithms are implemented:
- FIFO – First In First Out
- LRU – Least Recently Used
- OPT – Optimal Page Replacement
- RAND – Random Replacement
- Second Chance – Clock / Second Chance algorithm
Each algorithm determines which memory page should be replaced when a page fault occurs.
src/ │ ├── PageReplacementAlgorithm.java # abstract base class ├── Simulation.java # program entry point │ ├── FIFO.java # FIFO algorithm ├── LRU.java # LRU algorithm ├── OPT.java # Optimal algorithm ├── RAND.java # Random replacement └── SecondChance.java # Second Chance algorithm
- Simulation of multiple page replacement strategies
- Comparison of algorithm behavior
- Page fault counting
- Object-oriented implementation
- Clear separation of algorithms and simulation logic
- Java
- Standard Java libraries
-
Compile the project: javac src/*.java
-
Run the simulation: java -cp src Simulation
This project demonstrates:
- memory management concepts in operating systems
- page replacement strategies
- algorithm comparison
- object-oriented design in Java
- simulation of system behavior
Created as a university project for a Operating Systems course.