Simulate and visualize Round Robin CPU scheduling algorithm which executes processes for a fixed time slice in a circular queue.
Round Robin (RR) is a CPU scheduling algorithm where each process is assigned a fixed time slot in a cyclic way. It is designed especially for time-sharing systems and is preemptive in nature. The scheduler assigns a fixed time unit per process, called a quantum or time slice, and cycles through them. Once a process is executed for the given time period, it's preempted and the next process in the queue is executed.
Processes are placed in a queue in the order they arrive in the system.
The CPU is allocated to a process for a time interval of up to one time quantum. If the process's remaining burst time is less than one time quantum, the process is executed until completion. Otherwise, the process is preempted after the time quantum expires and placed at the back of the ready queue.
The scheduler picks the next process from the front of the queue and repeats step 2 until all processes are completed.
When all processes are executed, the algorithm calculates performance metrics like average turnaround time and average waiting time.