This project is a comprehensive CPU Scheduling Simulator designed to visualize and analyze the performance of various scheduling algorithms commonly studied in Operating Systems courses. It features a graphical user interface (GUI) built with tkinter, animated Gantt charts using matplotlib, and the ability to load real-time process data from the operating system using psutil.
- Interactive GUI: User-friendly interface built with
tkinter. - Animated Gantt Charts: Visualize the execution timeline of processes with a step-by-step animation.
- Performance Metrics: Calculate and display key performance indicators:
- Completion Time (CT)
- Turnaround Time (TAT)
- Waiting Time (WT)
- Average Turnaround Time (Avg TAT)
- Average Waiting Time (Avg WT)
- CPU Utilization and Throughput
- Context Switch Overhead (CSO): Algorithms can be simulated with a customizable Context Switch Overhead (CSO) time.
- Live Process Loading: Load a snapshot of currently running OS processes to use as input for the simulation, with estimated Burst Time and Priority based on CPU usage and niceness.
- Theme Switching: Toggle between Dark and Light themes.
- Export Results: Export all simulation data (input, metrics, timeline) to a CSV file.
The simulator includes implementations for both non-preemptive and preemptive versions of popular algorithms:
- First-Come, First-Served (FCFS)
- Shortest Job First (SJF) - Non-Preemptive
- Shortest Remaining Time First (SRTF) - Preemptive (Preemptive SJF)
- Priority - Non-Preemptive
- Priority - Preemptive
- Round Robin (RR) (with adjustable time quantum)
You must have Python installed (Python 3.x is recommended).
The required libraries are listed in requirements.txt.
-
Clone the repository:
git clone [https://github.com/vinitkumargupta/cpu-scheduling-simulator.git](https://github.com/vinitkumargupta/cpu-scheduling-simulator.git) cd cpu-scheduling-simulator -
Install the required packages:
pip install -r requirements.txt
Note: The
psutillibrary is required for the "Load Live Processes" feature.
To launch the GUI, run the main script from the src directory:
python src/main_gui.py