Processor scheduling

Processor scheduling


Scheduler type
Max time slice
Speed

How Scheduler Types Work

First come first served. The first process to arrive to the CPU runs first, and continues until it is finished. Then the next process is run. FCFS is simple to understand and also simple to implement, however, long tasks my dominate the processor's time. Round robin. The CPU gives each proccess a set amount of time (time slice). When this time slice, if the process isn't finished, it is sent to the back of the queue. This cycle repeats until all the processes are finished. It prevents one task from dominating the processor, and each task is allocated without a long wait. However, as more processes run, the time slice decreases meaning more urgent tasks are less likely to be completed as quick Shortest job first. The CPU runs the process with the shortest execution time. If a new process arrives with a shorter execution time, then the current proccess is interrupted and the new process is run. SJF also reduces the average waiting time, but long processes may wait for a long time (starvation) if lots of shorter processes are added. Shortest remaining time. The CPU runs the process with the shortest remaining execution time. If a new process arrives with a shorter remaining time, the current process is interrupted and the new process is run. SRT reduces the average waiting time, but long processes may wait for a long time (starvation). However, if a long process has a short remaining execution time it will have a higher priority than if it was SJF Multi-level feedback queue. A new process enters the first queue, and is run for a set amount of time. If it is not finished it moves down to a lower priority queue, which also has a set time. If it is still not finished it keeps moving down queues until at the lowest priority queue. Processes in higher queues have a higher priority and so are run first. However, process that have had to wait for a long time may be moved up queues to avoid starvation. Processes that depend on I/O devices require a lot of processing time, but are kept in high priority queues. This ensures that more important tasks are dealt with sooner, but no single high-priority task dominates the processor's time.