The CPU Scheduling Simulator is a Python-based graphical user interface (GUI) application designed to simulate various CPU scheduling algorithms. It enables users to add processes with specific parameters and simulate the behavior of different scheduling algorithms to observe the results, including start time, completion time, turnaround time (TAT), and waiting time (WT).
- Add custom processes with:
- Process ID
- Arrival Time
- Burst Time
- Priority (optional)
- Simulate the following scheduling algorithms:
- First Come First Serve (FCFS)
- Non-Preemptive Shortest Job First (SJF)
- Preemptive Shortest Job First (SJF)
- Round Robin (RR) with user-defined quantum
- Priority Scheduling
- View the results of each algorithm in a user-friendly text display.
- Python 3.x
- Required libraries:
tkinter
,ttk
- Clone or download this repository.
- Navigate to the directory containing the
cpu_scheduling_simulator.py
file. - Run the script using the command:
python cpu_scheduling_simulator.py
- Launch the application.
- Add processes:
- Fill in the
Process ID
,Arrival Time
, andBurst Time
fields. - Optionally, provide a
Priority
(only needed for priority scheduling). - Click Add Process to save the process details.
- Fill in the
- Select an algorithm from the dropdown menu:
- FCFS: First Come First Serve
- Non-Preemptive SJF: Non-Preemptive Shortest Job First
- Preemptive SJF: Preemptive Shortest Job First
- Round Robin: Requires the
Quantum
field to be filled - Priority Scheduling: Requires process priorities
- Click Simulate to run the selected algorithm and view the results.
Processes are executed in the order of their arrival time.
The process with the shortest burst time is selected for execution once it arrives.
Processes are scheduled dynamically based on the shortest remaining burst time.
Processes are executed in a cyclic manner with a user-defined quantum.
Processes are scheduled based on their priority, with lower values indicating higher priority.
- Input Fields: Fields to add process details.
- Algorithm Selection: Dropdown menu to select a scheduling algorithm.
- Quantum Input: Field for specifying the quantum for Round Robin scheduling.
- Results Display: A text area to display the scheduling results.
After simulating a scheduling algorithm, results are displayed in the following format:
P1: Start: 0, Completion: 4, TAT: 4, WT: 0
P2: Start: 4, Completion: 9, TAT: 7, WT: 2
P3: Start: 9, Completion: 15, TAT: 10, WT: 3
- Start: Time when the process started execution.
- Completion: Time when the process completed execution.
- TAT: Turnaround Time (Completion Time - Arrival Time).
- WT: Waiting Time (TAT - Burst Time).
If you'd like to contribute, feel free to fork the repository and submit a pull request with improvements or additional features.
This project is licensed under the MIT License. See the LICENSE
file for details.
This project utilizes:
tkinter
for GUI development.- Python's data structures and algorithms for scheduling logic.