chap9
chap9
Chapter 9
Goals of Scheduling
Long-term
performed when new process is created
Medium-term
swapping
Short-term
decision as to which ready process will be executed
by the processor
I/O
decision as to which process’s pending I/O request
shall be handled by available I/O device
Scheduling and Process
State Transition
New
Long-term Long-term
scheduling scheduling
Ready,
Ready Running Exit
suspend
Medium-term Short-term
scheduling
scheduling
Blocked,
Blocked
suspend
Medium-term
scheduling
Queuing Diagram for
Scheduling
Long-term Time-out
scheduling
Batch Short-term
Ready Queue Release
jobs scheduling
Processor
Medium-term
scheduling
Interactive Ready, Suspend Queue
users
Medium-term
scheduling
Blocked, Suspend Queue
Blocked Queue
Event Wait
Event
Occurs
Long-Term Scheduling
Swapping
Based on the need to manage
multiprogramming (it is hard to foresee
the CPU and memory requirements of
processes in the long-term scheduling
phase).
Short-Term Scheduling
User-oriented
Response Time
o Elapsed time between the submission of a request until
there is output.
System-oriented
effective and efficient utilization of the processor
Performance-related
response time and throughput
Not performance related
predictability (e.g., fairness, no starvation)
Priorities
RQ1
.
Admit .
.
RQn
Preemption
Event Wait
Event
occurs Blocked Queue
Decision Mode
Nonpreemptive
Once a process is in the running state, it will
continue until it terminates or blocks itself for
I/O
Preemptive
Currently running process may be interrupted
and moved to the Ready state by the
operating system
Allows for better service since no process can
monopolize the processor for very long
An Example
Arrival Service
Process Time Time
1 0 3
2 2 6
3 4 4
4 6 5
5 8 2
First-Come-First-Served
(FCFS)
0 5 10 15 20
1
2
3
4
5
1
2
3
4
5
1
2
3
4
5
Nonpreemptive policy
Process with shortest expected
processing time is selected next
Short process jumps ahead of longer
processes
Shortest Process Next
1
2
3
4
5
1
2
3
4
5
1
2
3
4
5
Penalize jobs that have been running longer
Can be used when we don’t know the remaining
time a process needs to execute
Implemented in UNIX (see later)
Fair-Share Scheduling