Lecture 8: CPU Scheduling 2 Flashcards
Shortest-Job-First (SJF) - Non-Preemptive Policy
Rank processes by CPU time requests.
Optimizes (minimizes) average waiting time
Shortest-Job-First (SJF) - Preemptive Policy
Currently running process can be preempted if new process arrives with shorter remaining CPU burst
Exponential Averaging
Uses “history” of previous CPU bursts to predict length of next CPU burst
tn:Actual length of nth CPU burst
tn+1: Predicted length of next CPU burst
ɑ:“Weight”:
→ How much emphasis to put on recent past
→ 0 ≤ a ≤1
States in the Ready Queue
New: Process is being created
Running: Instructions are being executed
Waiting: Process is waiting for some event to occur
Ready: Process is waiting to be assigned the CPU
Terminated: Process has finished execution
Priority Policy
•Priority Number (Integer) Associated With Each Process
•CPU Allocated to Process With Highest Priority (Lowest Priority Number)…
3a. Non-preemptive:
Whenever running process blocks or terminates
3b. Preemptive:
Whenever new process arrives or running process blocks or terminates
Round-Robin
•Each process gets small unit of CPU time (time quantum).
•After time quantum has elapsed, process is
preempted and added to end of ready queue
•Preemptive only: Process switch based on timer interrupts
Multilevel Queues
Ready queue is partitioned into separate queues, each with own scheduling algorithm
Inter-queue Scheduling (Scheduling of Queues)
- Fixed Priority:
Serve all from high-priority queue before servicing lower-priority
queue (–: starvation) - Time-slice:
Each queue gets reserved slice of CPU time to schedule amongst its
processes (e.g.: 80% for hi-priority, 20% low)
Scheduling Metrics
- CPU utilization, throughput, turnaround time, wait time, response time
- Also care about: fairness, dispatch time