AlgoFrames

Build the round-robin schedule

Standard · Trace the algorithm · about 7 min

Round robin with quantum 2 runs P1 (arrival 0, burst 5), P2 (arrival 1, burst 3) and P3 (arrival 2, burst 4). A process that arrives while another runs joins the queue before the preempted process goes to the back. Build the schedule, then read the waiting time off the chart.

Example 1

Input:

{"quantum":2,"processes":[{"name":"P1","arrival":0,"burst":5},{"name":"P2","arrival":1,"burst":3},{"name":"P3","arrival":2,"burst":4}]}

Output:

P1 P2 P3 P1 P2 P3 P1

Constraints

  • The trace uses the input shown.
  • Quantum 2, one CPU, no switch cost.

Learn the idea first: CPU scheduling: FCFS, SJF, priority, round robin, a visual lesson.

More CPU scheduling: FCFS, SJF, priority, round robin problems