'Round-Robin Scheduling with Arrival Times

So in class, my professor was going over round robin scheduling. Consider this situation:

Job       |    Arrival       |      Burst
A         |       0          |        3
B         |       1          |        5
C         |       3          |        4

My professor wrote down the results as follows:

Time
1 2 3 4 5 6 7 8 9 10 11 12
A A B A B B C C B C  B  C

At times 0-1, A has being processed for one burst. At time 1-2, A is being processed for another burst. At time 2-3 B is being processed for a burst, and so on and so forth.

What I'm confused about is at times 6-8. B is processed again from time 5-6. Then C from time 6-7, and C again from time 7-8. Shouldn't it instead be this:

Time
1 2 3 4 5 6 7 8 9 10 11 12
A A B A B C B C B C  B  C


Solution 1:[1]

At first each and every round robin question is based on quantum.(ex-quantum = 4). It means each and every process will take same quantum time for execution. for your example if quantum=2. then it seems like

A        B      C       A     B       C          B

0  -  2  - A

2  -  4  - B

4  - 6   - C

6  - 7   - A

7  - 9   - B

9  - 11  - c   

11 -12   - B

Waiting time of process Waiting time = (starting time of final execution – previous executed cycle – arrival time)

A –  (6-2-0)=4


B – (11-(2+2)-1)=6

C – (9-2)-3=4

Average waiting time = (4+6+4)/3 = 14/3 = 4.66

Solution 2:[2]

The other answers I believe are incorrect. After process A ends at time 2, B will be added to the queue since it has arrived and then A will be added back to the queue since it has not finished execution and C is not available yet. Job C will be added to the queue at time 4 after B has utilized it's first quantum. The correct order should be as follows:

A: 2
B: 2
A: 1
C: 2
B: 2
C: 2
B: 1
Average waiting time: 4.0

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Nihal Rp
Solution 2 madridista