This part of the OS Lab Project is a GUI-based educational tool that visually illustrates how virtual memory is managed in an operating system using different page replacement algorithms. It is built using Python and Tkinter, with matplotlib for graphical statistics.
To help students understand virtual memory concepts and page replacement mechanisms like:
- FIFO (First-In-First-Out)
- LRU (Least Recently Used)
- Optimal
- MRU (Most Recently Used)
This tool simulates the memory access process and displays how pages are loaded into physical frames, with visual feedback and page fault tracking.
- Input any page reference string.
- Select one of four algorithms: FIFO, LRU, Optimal, MRU.
- Step-by-step simulation of memory allocation and page replacement.
- Real-time Page Table View and Physical Memory Frame Visualization.
- Page fault counter with live updates.
- Statistics window comparing total page faults across all algorithms using a bar graph.
virtual_memory_gui/
├── vm_gui.py # Main GUI simulator script
├── assets/ # Optional folder for icons/images (currently empty)
└── README.md # This file- Python 3.x
- tkinter (usually comes with Python)
- matplotlib
pip install matplotlibpython vm_gui.py- Enter a Page Reference String
(e.g., 7 0 1 2 0 3 0 4 2 3 0 3 2). - Choose an Algorithm from the dropdown.
- Click Start Simulation to initialize.
- Click Next Step to simulate memory access one page at a time.
- View the Physical Memory and Page Table updating live.
- Use Show Statistics to compare total page faults across all algorithms.
- Use Reset to start a new simulation.
- Memory frames update visually with
page numbersandcolor changes. Page tablereflects whichpageis in whichframeand the validbit.Page faultsare counted and displayed.- A statistics window shows a comparison graph of page faults for
FIFO,LRU,Optimal, andMRU.
- Added support for the MRU (Most Recently Used) page replacement algorithm.
- Improved visualization of memory frames and page tables.
- Enhanced statistics window with a bar graph comparing page faults across algorithms.
-
This tool strengthens conceptual understanding of:
-
Page faults
-
Frame allocation
-
Memory access patterns
-
How various page replacement algorithms work
This simulator is built for educational purposes. Contributions and improvements are welcome through pull requests or issues.