This project is a graphical simulation of different CPU scheduling algorithms implemented using Python's Tkinter and Turtle libraries. The simulator visualizes the execution of processes using First-Come, First-Served (FCFS), Shortest Job First (SJF), and Round Robin (RR) scheduling algorithms. This project was a part of the course CSS225 Operating System by SIIT.
- Visual representation of process scheduling using a Gantt chart.
- Simulation of FCFS, SJF (both preemptive and non-preemptive), and RR scheduling algorithms.
- Calculation and display of average waiting time, turnaround time, and response time.
- Interactive interface using Tkinter.
-
Clone the repository:
git clone https://github.com/SorawitChok/Process-Scheduling-Simulation-Project.git
-
Install the required dependencies: Ensure you have Python installed. No additional libraries are required as the project uses Tkinter and Turtle, which come with standard Python installations.
-
Run the simulator:
python simulator.py
- Launch the simulator using the command above.
- Input the process data (Process ID, Arrival Time, Burst Time).
- Select the scheduling algorithm you want to simulate (FCFS, SJF, RR).
- Click "Start Simulation" to see the visual representation of the process scheduling.
The user interface (UI) of the Process Scheduling Simulator is designed to be simple and intuitive, making it easy for users to input data and visualize the scheduling algorithms. It is built using Python's Tkinter library and consists of the following components:
-
Input Section:
- Process ID: A text field to input the unique identifier for each process.
- Arrival Time: A text field to enter the time at which each process arrives in the queue.
- Burst Time: A text field for entering the CPU burst time required by each process.
-
Algorithm Selection:
- A set of radio buttons allowing the user to choose between FCFS, SJF, and RR scheduling algorithms.
-
Simulation Controls:
- Additional Process: Buttons to add or remove the number of process to simulate.
- Start Simulation: A button that begins the simulation based on the entered data and selected algorithm.
-
Output Section:
- Displays the Gantt chart representing the execution order of processes.
- Shows calculated metrics such as average waiting time, turnaround time, and response time.
This is an example of our system's user interface.
- Description: The simplest scheduling algorithm, where the process that arrives first is executed first.
- Characteristics: Non-preemptive, straightforward but can cause long waiting times, especially if a long process arrives before shorter ones.
- Description: Executes the process with the shortest burst time first.
- Characteristics: Can be preemptive or non-preemptive. Minimizes average waiting time but requires accurate prediction of burst times.
- Description: Each process is assigned a fixed time slice (quantum) and is cycled through in order until completion.
- Characteristics: Preemptive, suitable for time-sharing systems. Provides a balance between responsiveness and throughput.
The simulator takes input for process IDs, arrival times, and burst times, then simulates the chosen scheduling algorithm. The Gantt chart is drawn using Turtle graphics, and the simulation results (waiting time, turnaround time, response time) are displayed on the screen.
- Processes: P1, P2, P3, P4, P5
- Arrival Times: 0, 2, 5, 10, 5
- Burst Times: 10, 5, 15, 20, 5
This code is licensed under the MIT License. See the LICENSE file for more details.
This repository was created by Sorawit Chokphantavee, Sirawit Chokphantavee, Narinthorn Chinvorarat, and Nathanon Rookheb.