Welcome to the Operating System Simulator! This is a comprehensive educational tool built in Python to help students and developers visualize core Operating System concepts through interactive simulations.
This simulator provides a graphical interface to explore and understand three fundamental pillars of Operating Systems:
- CPU Scheduling: How processes share the processor.
- Contiguous Memory Allocation: How memory blocks are assigned to processes.
- Page Replacement: How memory management handles page faults in virtual memory.
Built with Tkinter for the UI and Matplotlib for visualization, it offers a seamless and informative experience.
Simulate how different strategies impact process execution:
- FCFS (First-Come, First-Served)
- SJF (Non-preemptive) (Shortest Job First)
- SJF (Preemptive / SRTF) (Shortest Remaining Time First)
- Round Robin (Time-shared execution with a custom quantum)
- Visualization: Generates a dynamic Gantt Chart with clear start and completion/interruption time labels.
- Metrics: Computes Completion Time, Turnaround Time, and Waiting Time for every process.
Explore how memory is managed in a contiguous space:
- First Fit: Allocates the first block that is big enough.
- Best Fit: Allocates the smallest block that is big enough.
- Worst Fit: Allocates the largest available block.
- Metrics: Tracks Process size, Block allocation, and Internal Fragmentation.
Analyze memory paging efficiency:
- FIFO (First-In, First-Out)
- Optimal: Replaces the page that will not be used for the longest time.
- LRU (Least Recently Used)
- Metrics: Displays Page Faults, Page Hits, Hit Ratio, and Miss Ratio for all algorithms simultaneously for easy comparison.
- Python 3.x: Core logic and scripting.
- Tkinter: Native GUI framework for the user interface.
- Matplotlib: Used for drawing professional-grade Gantt charts.
- ttk.Treeview: For clean, tabulated data representation.
OS Simulator/
├── main.py # Entry point & Main Menu
├── cpu_scheduling.py # CPU Scheduling logic & UI
├── memory_allocation.py # Memory Allocation logic & UI
├── page_replacement.py # Page Replacement logic & UI
├── README.md # Project Documentation (You are here)
├── README.txt # Legacy documentation
└── .gitignore # Python ignore rules
You can run this application either from the source Python files or directly via the bundled executable.
- Navigate to the
dist/folder in the project directory. - Double-click
main.exeto launch the OS Simulator immediately.
- Clone or Download the project files to your local machine.
- Install Dependencies:
Ensure you have
matplotlibinstalled. If not, run:pip install matplotlib
- Run the Application:
Execute the
main.pyscript from the terminal:python main.py
- Enter the Number of Processes.
- Click Set Processes to generate input fields.
- Input Arrival Times (defaults to 0 if empty) and Burst Times.
- Choose an algorithm and set the Quantum if using Round Robin.
- Click Simulate to see the table results and the pop-up Gantt Chart.
- Provide Free Memory Blocks as comma-separated integers (e.g.,
100, 500, 200). - Provide Process Memory Requests as comma-separated integers (e.g.,
212, 417). - Select an allocation strategy and click Simulate.
- Set the Frame Size (number of memory frames).
- Input the Reference String (comma-separated page requests).
- Click Simulate All to compare FIFO, Optimal, and LRU results instantly.
- Gantt Chart: A clear timeline showing when each process starts and ends.
- Tabulated Data: High-level statistics including Average Waiting and Turnaround times.
- Fragmentation Tracking: Clear indication of wasted memory space in allocation simulations.
This project was developed for educational purposes as part of an Operating Systems course.