A Java application that simulates various CPU scheduling algorithms with an interactive GUI built using JavaFX.
- Supports multiple CPU scheduling algorithms:
- First Come First Serve (FCFS)
- Shortest Job First (SJF)
- Shortest Remaining Time First (SRTF)
- Round Robin (with configurable time quantum)
- Interactive process input with validation
- Real-time visualization using Gantt charts
- Comprehensive metrics including:
- Average Waiting Time
- Average Turnaround Time
- CPU Utilization
- Throughput
- Java Development Kit (JDK) 17 or later
- Maven 3.6 or later
- Clone the repository.
- Navigate to the project directory.
- Build the project:
mvn clean package
- Run the application:
mvn javafx:run
- Select a scheduling algorithm from the dropdown menu.
- For Round Robin, enter the desired time quantum.
- Add processes by entering:
- Process ID (any string identifier)
- Arrival Time (non-negative integer)
- Burst Time (positive integer)
- Click "Add Process" to add each process to the simulation.
- Click "Run Simulation" to execute the selected algorithm.
- View the results in the Gantt chart and metrics section.
- Use "Clear All" to reset the simulation.
- Average Waiting Time: Average time processes spend waiting in the ready queue.
- Average Turnaround Time: Average time taken to complete a process.
- Throughput: Number of processes completed per unit time.
- CPU Utilization: Percentage of time the CPU is actively processing.
The simulator implements four classic CPU scheduling algorithms:
-
First Come First Serve (FCFS)
- Non-preemptive
- Processes are executed in the order they arrive.
-
Shortest Job First (SJF)
- Non-preemptive
- Selects the process with the shortest burst time.
-
Shortest Remaining Time First (SRTF)
- Preemptive version of SJF
- Switches to shorter processes when they arrive.
-
Round Robin
- Preemptive
- Each process gets a fixed time quantum.
- Processes are executed in a circular manner.
