0
0
Operating Systemsknowledge~10 mins

Round Robin scheduling in Operating Systems - Step-by-Step Execution

Choose your learning style9 modes available
Concept Flow - Round Robin scheduling
Start with ready queue
Pick first process
Run process for time quantum
Process finished?
YesRemove from queue
No
Move process to end of queue
More processes in queue?
YesPick next process
No
End
Round Robin scheduling cycles through processes, giving each a fixed time slice, then moves unfinished processes to the queue's end until all finish.
Execution Sample
Operating Systems
Processes = [P1(5), P2(3), P3(7)]
Time Quantum = 2
While processes remain:
  Run current process for 2 units
  If done, remove
  Else, move to end
This simulates running three processes with different burst times using a 2-unit time slice each cycle.
Analysis Table
StepCurrent ProcessTime RunRemaining Time BeforeRemaining Time AfterQueue StateAction
1P1253[P1, P2, P3]Run P1 for 2, move to end
2P2231[P2, P3, P1]Run P2 for 2, move to end
3P3275[P3, P1, P2]Run P3 for 2, move to end
4P1231[P1, P2, P3]Run P1 for 2, move to end
5P2110[P2, P3, P1]Run P2 for 1, finish and remove
6P3253[P3, P1]Run P3 for 2, move to end
7P1110[P1, P3]Run P1 for 1, finish and remove
8P3231[P3]Run P3 for 2, move to end
9P3110[P3]Run P3 for 1, finish and remove
10----[]All processes finished, stop
💡 All processes have zero remaining time, queue is empty, scheduling ends.
State Tracker
VariableStartAfter 1After 2After 3After 4After 5After 6After 7After 8After 9Final
P1 Remaining Time53311110000
P2 Remaining Time33111000000
P3 Remaining Time77755533100
Queue State[P1, P2, P3][P2, P3, P1][P3, P1, P2][P1, P2, P3][P2, P3, P1][P3, P1][P1, P3][P3][P3][][]
Key Insights - 3 Insights
Why does a process move to the end of the queue after its time quantum?
If the process is not finished after its time quantum (see steps 1, 2, 3), it must wait its turn again, so it moves to the queue's end to allow others to run.
What happens when a process finishes before using the full time quantum?
At step 5, P2 only needs 1 unit to finish, so it runs less than the quantum and is removed immediately from the queue.
How do we know when the scheduling ends?
When the queue is empty (step 10), all processes have finished, so the scheduler stops running.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution table, what is P1's remaining time after step 4?
A3
B0
C1
D5
💡 Hint
Check the 'Remaining Time After' column for P1 at step 4 in the execution_table.
At which step does P2 finish execution?
AStep 5
BStep 4
CStep 7
DStep 9
💡 Hint
Look for when P2's remaining time becomes 0 in the execution_table.
If the time quantum was increased to 3, how would the queue state after step 1 change?
A[P2, P3, P1]
B[P3, P1, P2]
C[P1, P2, P3]
D[P2, P1, P3]
💡 Hint
With a 3-unit quantum, P1 would run for 3 units, reducing its remaining time from 5 to 2, then move to the end; check how this affects queue order.
Concept Snapshot
Round Robin Scheduling:
- Each process runs for a fixed time slice (quantum).
- If unfinished, process moves to queue end.
- Continues cycling until all finish.
- Fair and simple for time-sharing systems.
- Prevents any process from starving.
- Time quantum size affects responsiveness and overhead.
Full Transcript
Round Robin scheduling works by cycling through all processes in the ready queue, giving each a fixed time slice to run. If a process finishes within its time slice, it is removed from the queue. If not, it is moved to the end of the queue to wait for its next turn. This continues until all processes have completed. The execution table shows step-by-step how processes run, their remaining times, and how the queue changes. Key moments include understanding why processes move to the queue's end, what happens when a process finishes early, and when the scheduling ends. The visual quiz tests understanding of remaining times, finishing steps, and effects of changing the time quantum.