Round Robin CPU Scheduling Algorithm
Round Robin Scheduling
1. Introductionâ
Round Robin (RR) is a preemptive CPU scheduling algorithm designed for time-sharing systems. Each process is assigned a fixed amount of CPU time called a time quantum or time slice. If a process does not complete within its time quantum, it is preempted and moved to the end of the ready queue.
This ensures fair CPU allocation among all processes.
2. How It Worksâ
- Processes are placed in a ready queue.
- The first process is given the CPU for one time quantum.
- If the process completes, it leaves the system.
- If it does not complete, it is moved to the back of the queue.
- The next process receives the CPU.
- The cycle repeats until all processes are completed.
3. Advantagesâ
- Fair CPU allocation to all processes.
- Good response time for interactive systems.
- Prevents process starvation.
4. Disadvantagesâ
- Performance depends heavily on the chosen time quantum.
- Excessively small time quantum increases context-switching overhead.
- Large time quantum makes RR behave similarly to FCFS.
5. Applicationsâ
Round Robin is commonly used in time-sharing and multitasking operating systems where multiple users or applications require responsive CPU access.
6. Evaluation Metricsâ
6.1 Waiting Timeâ
Waiting time is the total amount of time a process spends in the ready queue waiting for CPU allocation. It does not include the time the process is actually executing.
Formula: Waiting Time = Turnaround Time â Burst Time
It tells how long a process has to wait before getting executed.
6.2 Turnaround Timeâ
Turnaround time is the total time taken by a process from its arrival to its completion.
Formula: Turnaround Time = Completion Time â Arrival Time
It includes both waiting time and execution time.