This project is a simulation of various CPU scheduling algorithms, comparing their performance in terms of average turnaround time (ATT) and average waiting time (AWT). The implemented algorithms include First-Come-First-Serve (FCFS), Shortest Remaining Time First (SRTF), Round Robin (RR), and Multilevel Feedback Queues (MLFQ).
-
Implemented Algorithms:
- FCFS (First-Come-First-Serve): Processes are executed in the order they arrive.
- SRTF (Shortest Remaining Time First): Preemptive execution based on the remaining burst time.
- RR (Round Robin): Each process is assigned a fixed time slice (quantum) for execution.
- MLFQ (Multilevel Feedback Queues): Processes move between different queues based on their behavior.
-
Process Generation:
- 8 processes are created in the ready queue.
- Each process has a random CPU burst time between 5 and 100 time units.
-
Order of Arrival:
- Processes are assigned an order of arrival (arrival time).
-
Algorithm-specific Configurations:
- RR uses a fixed time slice (quantum) of 20 units.
- MLFQ employs three queues with different time slices.
-
Performance Metrics:
- Average Turnaround Time (ATT): The total time taken for a process to complete.
- Average Waiting Time (AWT): The total time a process spends waiting in the ready queue.
-
Multiple Iterations:
- The simulation is repeated for 100, 1000, 10000, and 100000 iterations.
-
Simulation Loop:
- The project runs a simulation loop for each algorithm and iteration count.
- For each iteration, the same set of processes is used across all algorithms.
-
Results Summary:
- A table is generated summarizing ATT and AWT for each algorithm and iteration count.
No. of Iterations | 100 | 1000 | 10000 | 100000 |
---|---|---|---|---|
ATT | * | * | * | * |
AWT | * | * | * | * |
No. of Iterations | 100 | 1000 | 10000 | 100000 |
---|---|---|---|---|
ATT | * | * | * | * |
AWT | * | * | * | * |
No. of Iterations | 100 | 1000 | 10000 | 100000 |
---|---|---|---|---|
ATT | * | * | * | * |
AWT | * | * | * | * |
No. of Iterations | 100 | 1000 | 10000 | 100000 |
---|---|---|---|---|
ATT | * | * | * | * |
AWT | * | * | * | * |
(*) Actual numerical results will be filled during the execution of the project.
To run the simulation, follow these steps:
-
Clone the Repository:
git clone https://github.com/BaselAbuHamed/CPU-Scheduling-Algorithms-.git cd CPU-Scheduling-Algorithms
-
Compile and run the application:
cd CPU-Scheduling-Algorithms javac CPUSchedulingSimulation.java java CPUSchedulingSimulation
Happy Simulating! 🚀