Round-Robin Scheduler
hardQuestion 500Write a round-robin CPU scheduler. Input: the first line holds the time quantum Q (a positive integer); every following line holds a process name and its burst time, separated by a space, until the input ends.
Queue the processes in the order they were read and start the clock at 0. Take the front process and run it for min(Q, remaining burst): add that amount to the clock and subtract it from the process's remaining burst. If its remaining burst is now 0, print NAME finished at time T on its own line, where T is the current clock value; otherwise push it to the back of the queue. Repeat until the queue is empty.
Example input: 3 A 6 B 2
The output for that input is shown in Expected Output.
Expected output
B finished at time 5 A finished at time 8 Q finished at time 3 P finished at time 7 R finished at time 8
= newline. The output ends with a newline, so print one after the last line.
Your output
Run your code to see the output here...