CPU Process Management Algorithm-Round Robin Algorithm- CPU Scheduling
Round Robin Algorithm- CPU Scheduling — Operating System
- Round Robin is the preemptive process scheduling algorithm.
- CPU is assigned to the process on the basis of FCFS for a fixed amount of time.
- Each process is provided a fix time to execute, it is called a quantum.
- Each process present in the ready queue is assigned the CPU for that time quantum, if the execution of the process is completed during that time then the process will terminate else the process will go back to the ready queue and waits for the next turn to complete the execution.
- Once a process is executed for a given time period, it is preempted and other process executes for a given time period.
Turn Around Time
It is the time interval from the time of submission of a process to the time of the completion of the process. TAT=Completion Time — Arrival time
Waiting Time:-
The time spent by a process waiting in the ready queue for getting the CPU. Waiting time=Turn Around Time-Burst Time
Example
there are Five processes named as P1, P2, P3, P4,and P5. Their arrival time and burst time are given below in the table. The time quantum of the system is 4 units.
According to algorithm we have to maintain ready queue and gantt chart.
Step-1 Initially at t=0,Process will be schedule for time quantum 4 unit. Hence in the ready queue there will be only one process i.e. P1
Ready Queue:-
Gantt Chart:-

Step-2:- After The execution, four more processes P2,P3, P4,and P5 arrives in the ready Queue, since P1 is not completed yet , it needs another 1 unit time hence it will also added back to ready queue.
Ready Queue:-
Gantt Chart:-

Check Complete Article Click Here
Disadvantages
- There is Low throughput.
- The higher the time quantum, the higher the response time in the system.
- The lower the time quantum, the higher the context switching overhead in the system.
Check Complete Article Click Here
Originally published at https://pywix.blogspot.com.