Lecture 5: CPU Scheduling Flashcards
define CPU scheduling
select processes from ready state, and allocate the CPU to them
nonpreemptive scheduling
take place when a process:
- switch from running to waiting state
- terminate
preemptive scheduling
take place when a process:
- switch from running to ready state
- switch from waiting to ready state
nonpreemptive vs preemptive scheduling
- Preemptive scheduling allows a running process to be interrupted by a high priority process
- in non-preemptive scheduling, any new process has to wait until the running process finishes its CPU cycle.
3 tasks involve in dispatcher module
- switching context
- switching to user mode
- jumping to proper location to restart program
define dispatch latency
time taken for dispatcher to stop a process and start a new running process
5 scheduling criteria
- CPU utilization: keep CPU as busy as possible
- throughput: number of process completed per time unit
- turnaround time: amount of time to complete a process
- waiting time: amount of time of a process waiting in ready queue
- response time: time taken from the request submitted until the first response (not output)
convoy effect
short process behind long process, causing many short process get blocked
- one CPU bound and many I/O bound process
ready queue is separated into 2 queues
- background (batch) using FCFS
- foreground (interactive) using RR
problem of priority scheduling
starvation
- process with long burst time will never execute
solution of starvation
aging
- priority of process increase by the time progress
formula for AWT (average waiting time)
turnaround time = finished time - arrived time
waiting time = turnaround time - burst time
multilevel feedback queue
process can move between various queue
parameters in multilevel feedback queue
- number of queue
- scheduling algorithm for each queue
- method determined when to upgrade a process
- method determined when to demote a process
- method determined which queue the process will enter
2 processor affinity
soft affinity - process has policy to attempt to keep running in the same processor
hard affinity - process can specify the subset of processor to run in