Chapter 2 · SimulationCPU Scheduling? ← Chapter 2ProcessArrival (ms)Burst (ms)PriorityFinishTurnaround timeWaiting time× ← Back Step → ▶ Play Reset Go to result Speed Try it yourself Correct: 0 / 0 CloseCPU schedulingGoal: Compare how different algorithms decide which process in the ready queue the scheduler gives the CPU to, and when, and work out waiting and turnaround times from the Gantt chart.AlgorithmsFCFS (first come, first served): the process that entered the ready queue first runs first; it does not give up the CPU until it finishes.SJF (shortest job first): when the CPU becomes free, the ready process with the shortest burst is chosen (non-preemptive).Round robin: each process in turn runs for at most one time slice; if it is not finished it goes to the end of the queue and a context switch occurs. A new process that arrives at the same moment enters the queue before the process whose time slice has just expired.Priority: when the CPU becomes free, the process with the smallest priority value (the highest priority) is chosen (non-preemptive).Ties are broken by arrival time first, then by process number.CalculationsFinish: the moment the process completes its work.Turnaround time = finish − arrival.Waiting time = turnaround time − CPU burst (the total time spent in the ready queue).How to use itChange the arrival, burst and priority values in the table; add up to 6 processes with + Process and delete them with ×.Step → animates the next CPU allocation, ← Back undoes it, Play runs to the end, and Go to result shows the whole chart. The → and ← keys also work.Try it yourself: when several processes are in the queue, you guess which one the scheduler will pick.Related slides: Chapter 2.1 · Software and Operating Systems (process management, time sharing: round-robin CPU allocation).