Scheduler: Allocate CPU processors to processes over time

Scheduler Metrics: Evaluate performance (throughput) and fairness

Short-term Scheduler / Dispatcher: Switch between ready and running threads

Process Lifecycle

Process typically alternate between CPU and I/O

Scheduling Goals

Batch Systems: Maximize throughput, minimize turnaround time, keep CPU busy

Interactive Systems: Response time (prioritize IO), proportionality (simple tasks run quickly)

Real-time Systems: Meet response deadlines, predictability

Non-preemptive Policies

Preemptive: CPU can be involuntarily taken away from a process

First-come First-serve: Always pop the thread at queue top and run to completion

Shorter Job First: Always pop the thread with the shortest (estimated) time

Preemptive Policies

Round Robin: Each process run for an equal time quantum q before switching.

Priority Scheduling

Priority Scheduling: Select highest-priority job from ready queue

Single-queue: Have a ready queue sorted by priority

Multi-level Queue: One ready queue per priority level

ML Feedback Queue: MLQ but adjust priority based on history

Proportional Share Scheduling

Proportional Share: Each user gets proportional CPU time regardless of number of processes

Lottery Scheduling: Each user assigned equal “tickets,” hold a lottery to find next process

Linux Scheduling

Linux 2.6

Linux Completely Fair Scheduler