Round Robin (RR):
In operating systems, tasks that are queued to be processed go through different scheduling algorithms in different operating systems. Round Robing or RR is one of them.
In round robin, like first come first served, the job or task that comes first, gets processed first, but not fully. Rather in round robin, a portion or segment of the task is completed at once, then the processor moves to the next task and then processes that same amount of task for this second task in hand and it continues. When a portion or segment of all tasks has been processed, the processor starts from the beginning of the task list again and continues to process a portion or segment of each remaining tasks. However in this way, as new task can be continuously added at the end of the task list, the processor might not come back to the head of the list sooner which might cause tasks to be waiting for much longer time ultimately resulting in halted situation.
However, I explained Round Robin (RR) in my another post earlier and as many of my readers wanted to have the source code, here I am publishing the source code of the program. I am not currently explaining the source code, please try to play with it to understand it. I am removing comments intentionally.
Program Output:
Following is a screenshot of the program with input and output.
I hope that you can now study and experiment the source code to write yours and that would be much better, more efficient and strict than this one.