P3L1 Flashcards
3 Options for scheduler
- Assign tasks immediately (FCFS)
- Assign simple tasks first (SJF)
- Assign complex tasks first
FCFS
First Come First Serve (FIFO)
SJF
Shortest Job First
CPU Scheduler runs when
- CPU become idles
- New tasks become ready
- timeslice expired timeout
runqueue is equal to
scheduling algorithm
“Run-to-completion” scheduling
No preemption
Metrics for schedulers
throughput
avg job completion time
avg job wait time
cpu utilization
Data structure for FCFS
Queue
Data structure for SJF
Ordered queue or tree
SJF + Preemption
heuristics based on history -> job running time
Priority Scheduling
Run highest priority next
Data structure(s) for Priority Scheduling
Queues for each priority
Tree with priority
How to deal with Priority Scheduling Starvation
priority aging function (actual priority, time spent in run queue)
What is Priority Invesion
Priorities inverted due to lock
Solution to Priority Inversion
Temp boost priority of mutex owner, lower on release
Round Robin Scheduing
Pick up first task from queue (task only yields to wait on I/O)
Round Robin w/ Priorities
Include preemption
Round Robin w/ interleaving
Timeslicing