CPU scheduling - decide which process to run first, use scheduling algorithm to choose
aims of CPU scheduling - minimize(fairness, response time,turnaround time), maximize(throughput, efficiency)
fairness - make sure all processes get fair of CPU time
efficiency - maximize CPU utilization
turnaround time - time between submission and job completion
throughput - number of job completed within the time period
pre-emptive scheduling- allow process running to be temporarily suspended, can stop after start, example: Round robin(RR)
non-pre-emptive scheduling - processes release CPU only after completion, once start it cannot stop, example: FCFS/FIFO, SJF, priority
Round Robin - design for time sharing system, oldest, simplest and widely used algorithm
FCFS/FIFO(first come first serve/first in first out) - simplest CPU scheduling, average waiting time is quite long, process that allocate for the CPU first is allocated the CPU
SJF(shortest job first) - scheduling with smallest burst point, if same burst point FIFO will use to break the tie, difficulty is to determine the length of next process, advantages: provide minimum average waiting time
priority - schedule with highest priority(starting from 1 is highest), equal priority use FIFO to break the tie, problem with priority is starvation, aging is a technique to increase priority of a process, can be pre-emptive or non-pre-emptive