
1
CS414: Operating Systems
Outline
•Last time
Finish off processes/threads (chapts 4/5)
Assignment #2 due
•This time
CPU Scheduling (chapt 6)
Assignment #3 out (due Thurs Oct 11)
•Next time
Finish CPU Scheduling (chapt 6)
Intro to synchronization (chapt 7)
•Midterm: Tues Oct 16 (closed books, closed notes)
CS414: Operating Systems
Before we start
•Blake’s office hours are on Wed for the next two weeks
CS414: Operating Systems
Motivation for Scheduling: CPU and I/O Bursts
•I/O-bound process: many short
CPU bursts
•CPU-bound process: very long
CPU bursts
•What should happen to the
CPU when a process performs
I/O?
•What should happen if a
process never/rarely performs
I/O?
load
store
add
store
read from file
wait for I/O
store
increment index
write to file
wait for I/O
load
store
add
store
read from file
wait for I/O
CPU burst
I/O burst
CPU burst
I/O burst
CPU burst
I/O burst
CS414: Operating Systems
Scheduling
•Multiprogramming:
running more than one process at a time enables the OS to increase system
utilization and throughout by overlapping I/O and CPU activities
•[Policy vs. Mechanism]
what to do vs. how to do it
separation is crucial! WHY?
•[Process Execution State] remember from a few classes ago
new, ready, running, waiting, terminated
•[Long-Term Scheduling]
How does the OS determine the degree of multiprogramming (the number of
jobs executing at once in primary memory)?
Invoked very infrequently (seconds, minutes may be slow)
•[Short-Term Scheduling]
How does the OS select a process from the ready Q to execute?
Invoked very frequently (milliseconds must be fast)
CS414: Operating Systems
Context Switches:
Voluntary vs. Involuntary
•Voluntary
context switcher is invoked by the process that intends to relinquish
the CPU (nonpreemptive scheduling); “yield” is for cooperative
model
I/O requests and termination can also invoke context switcher
•Involuntary
Interrupt handler executes context switcher (preemptive scheduling)
Interval timer is used
CS414: Operating Systems
Scheduling Criteria
•user-oriented, performance-related
[Response Time] (can be referred to as “wait time”) time from submission of
job to start of execution of job
[Turnaround Time] time from submission of job to completion of job
[Deadlines] time at which computation must complete
•user-oriented, other
[Predictability] job should run about the same amount of time regardless of
load
•system-oriented, performance-related
[Throughout] jobs completed per unit time
[Processor Utilization] percentage of time that processor is busy
•system-oriented, other
[Fairness] jobs should be treated the same
[Balancing Resources] keep all resources busy