CSE 7343/5343, Spring 2003
Topic 3: CPU Scheduling
Prof. Jeff Tian, CSE/SoE/SMU, Dallas, TX 75275
tian@engr.smu.edu; www.engr.smu.edu/~tian/class/7343.03s
- Dates: 1/30-2/6.
- Reading: Ch6.
Scheduling Concepts: Why?
- why scheduling
- view from task side:
CPU vs. I/O bursts
meet demand without much delay
"time" performance
- resource side:
single CPU and multiple I/O devices
efficient resource utilization
- focus: CPU scheduling (why?)
- effect of scheduling
- better for both sides
- characteristics of jobs/bursts:
- I/O bursts, relatively long
- waiting for I/O to finish
- parallelism in devices and control
- simple queue
- CPU bursts
- typical distribution: Fig 6.2 (p.153)
- exponential (what is it like?)
- hyper-exponential (?)
- minimal task
- few long ones
- implications on scheduling algorithms
- measurement/prediction of burst length?
=> implications on scheduling algorithms
Scheduling Activities and Criteria
- characteristics of process scheduling:
- CPU scheduling, short-term scheduling
- queuing discipline and capacity
- priority: explicit vs implicit
- preemptive?
- handling CPU bursts?
- duration: ready, select, dispatch, running
- selection: scheduling algorithm
- dispatching: switch context as well as mode, pick up from where left off
- job mix => long term scheduling
- other situations, medium term scheduling before
- scheduling criteria (<- effect?)
- both sides: user/task side + system/resource side
- performance measures
- utilization measures
- commonly used criteria
- CPU utilization (and other utilization)
- throughput
- turnaround time
- waiting time
- response time
- commonly used measures
- time: direct measure
- utilization measured over time
- throughput measured over time per process
- system performance:
- use above criteria/measures
- minimize time
- maximize throughput and utilization
- average vs worst case measure
- Gantt charts
to illustrate algorithms and
to determine performance
- evaluation techniques, more later
Basic Scheduling Algorithms
- commonly used algorithms
- FIFO or FCFS
- SJF
- round robin (RR)
- other
- FIFO example
- main advantage: fairness and simplicity
- main problem with FIFO: performance
- dealing with problem => other scheduling algorithms
- SJF: shortest job first
- dealing with FIFO performance problem
- motivation and example
- optimality: sketch of proof
- non-preemptive, no added context switching
- difficulty: "shortest"? how to determine?
- estimate and prediction methods
- based on time-series (AR, and MA)
- "exponential" model,
weights on last observation and estimates
formula: p.159
sample effect: Fig 6.3, p.160
- starvation possibility
- RR: round robin
- time quantum (tq)
- balance (fast) performance and fairness
- FIFO with preemption
- example
- key decision: tq selection
- two small: context switching cost up
- two large: poor performance
- decision: most done without context switching
- special case, fast context switching, small tq
processor sharing: 1/n of the processor
example: multiple set of registers
implementation connection to threads
Other algorithms and implementation concerns
- general prioritized and/or pre-emptive scheduling
- concept and example
- setting the priority:
internal: computation on resource, type, job mix, etc.
external: importance, $, account, etc.
- starvation problem: indefinite blocking
- aging solution
- preemptive SJF: SRTF
- Other scheduling algorithms and mixed queues
- mixing FIFO with priority
example in Fig 6.6 (p.166)
- aging implementation in above case
- generalize: feedback queues
example in Fig 6.7 (p.168)
- general mixed queues
- selection within individual queues
- selection among the queues
- swapping
- feedback scheme
- added overhead and complexity
- other scheduling
- multiprocessor scheduling
similar to multi-queue scheduling with added complexity
- real-time scheduling
time-bound
- thread scheduling
same basic concept
examples in textbook
Algorithm Evaluation
- evaluation techniques
- deterministic: most of the above examples
should be able to do for hw/exams
other three: basic concept only
- queuing theory: statistical models (of stochastic processes)
- simulation: system and traffic profiles used in simulation
example Fig. 6.9, p.176
- benchmarking: real system, standard benchmarks
- actual measurement: real system, real workload/traffic
- common purpose: performance evaluation results
- general study: performance evaluation
Prepared by Jeff Tian
(tian@engr.smu.edu).
Last update Feb. 4, 2003.