- block / wait
- POSIX signal
- interrupt
- round-robin
- preemptive
- save and restore registers
- switch address space (expensive instructions)
- cache
- buffer
- TLB miss
Multiprogramming
- Maximize CPU utilization.
- Degree: number of processes currently in memory
- # of running process = # of cores
CPU-bound process:
- user time > sys time
- do more computations than I/O
I/O-bound process:
- sys time > user time
- do more I/O than computations
preemptive scheduler vs cooperative scheduler.
- arrival time
- CPU requirement
- number of context switches
- individual & average waiting time
- individual & average turnaround time
individual turnaround time = finish time - arrival time
individual waiting time = turnaround time - required time
waiting time = turnaround time - required time
longer time, little content switches
shorter time, many content swtiches
Each process has a quantum number. When all processes have 0 quantum, recharge is executed. Context swtich is needed even there is only one process left. worse than SJF, but easier to implement
Linux use multiple priority queues