Question: Do the code in the C++ programming language. Background: 4a. Round Robin Scheduling Algorithm A queue of processes are maintained for all the available processes

Do the code in the C++ programming language.
Background: 4a. Round Robin Scheduling Algorithm A queue of processes are maintained for all the available processes in the system according to their arrival time. A process P in the system is selected as per the FCFS rule and given opportunity in the CPU for a pre-defined time quantum Q. If the remaining CPU timer of the process is less than the time quantum Q, a context switch takes place after r amount of time and the process P leaves the queue. Otherwise, the process Pruns for Q time quantum and a context switch takes place after Q amount of time. The process P goes to the end of queue for more time quantum until it finishes its required amount of time. Example Process Arrival Time CPU Time P1 4 5 P2 0 7 P3 6 9 P4 10 9 Time Quantum Q = 3 Gantt chart: |---P2-----2----------P3------P2------------------3---------P3---------- 0 3 6 9 12 13 15 18 21 24 27 30 Waiting Time Turnaround Time P1 6-4 + 13-9 =6 6+5=11 P2 0 + 12-6 = 6 6+7=13 P3 9-6 + 18-12 + 24-21 = 12 12+9=21 P4 15-10 + 21-18 + 27-24 =11 11+9=20 Average Waiting Time: (6+6+12+11) /4 = 8.75 Average Turnaround Time: (11+13+21+20) / 4 = 16.25
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
