Round Robin is a very popular CPU scheduling algorithm. A CPU scheduling algorithm is nothing but an algorithm which schedules the processes based on their arrival time, burst time and CPU's time quantum. Arrival time of a process, as the name signifies, is the time at which the process came for scheduling. Burst time of a process is the time required for it to complete. And time quantum is the time limit which is set by the cpu, one process can run for at max t units of time or time quantum.
We do multi tasking on our machines, we download a movie from the internet, play music, and do programming, all at the same time. But our computer don't have many cores, to take multiple requests. Our CPU uses context-switching to overcome the problem of lack of processing cores / processors. It might seem to us that all the processes are executing in parallel, but they are not. CPU's scheduling algorithm runs one process for some time, halts it, and runs other process for some time. This context switching is so fast that it seems that all the processes are running in parallel.
You might wonder that why don't we have multiple processors. Well we can have multiple processors, but it would be waste of money and most of the time our processors would be in idle condition.
Multiple processes come to the CPU for scheduling, these processes have their arrival time and burst time. The processes are entertained on the basis of their arrival time, i.e, the process which has less arrival time means that the process came early and should be processed first as per first come first serve rule.
Consider these processes:
Now we have something called the "Ready queue" and "Running queue" in which processes are added. When Arrival time of CPU matches the CPU time, the process is ready to be processed and hence, added to the ready queue. For example, process p1 has arrival time 0, So currently our ready queue will have process p0.
Lets set the time quantum to 2 units.
After 2 units of time, process p2 will arrive and then it will be added to the ready queue
Ready queue is used to see the processes which have arrived, and processing is done in the "running queue".