Scheduling Flashcards
What is the purpose of scheduling?
want to maximise throughput and execute many processes in the least amount of time
Reamble-process queue
as a program is waiting to be executed it is stored in a queue
The scheduling algorithms
first come first served (FCFS)
shortest job first (SJF)
shortest remaining time
round robin
multi level feedback queue
First come first served
each process is executed in the order it arrives in he queue
once a process is being executed in the CPU it is executed in full
Consequences of first come first served
takes up lots of time and processes will have to wait sometimes for a very long time
Shortest job first
each process has an estimated length of execution
queue is constantly sorted to keep the shortest job at the front of the queue
when a process enters the CPU it is executed in full
Consequences of shortest job first
of process with a long execution time enters the CPU all the processes will still have to wait
if there is a process with a long execution time in the queue it will always be shuffled back and starved of CPU time
Shortest time remaining
each process still has an estimate for the time needed to execute
only execute the process with the shortest time remaining even if that means suspending the current process
Issues with shortest time remaining
estimating how long a process is going to execute is hard to do accurately
process with a long execution time will have to wait until all the other processes are complete
importance of a program is ignored
Round robin
works with the concept of time slices or quanta
process can only be executed one time slice at a time
if after this time slice the process still hasn’t finished it gets put to the back of the queue and the next process in the queue starts being executed
don’t need to predict how long it will take
Consequences of round robin
considered fair scheduling algorithm
no priority give to any process every process is given equal priority to the CPU
no process is starved of CPU time
easy to implement and don’t need to predict how long a process needs to execute
good compromise between executing long and short processes
Multi-level feedback queue
multi core CPUs
can give each CPU core a queue to hold processes waiting to be executed
each queue can be given different priorities and use different scheduling algorithms
processes can be moved between queues as priorities change which prevents starving