Lecture 04 t1 1516
Lecture 04 t1 1516
Lecture 04 t1 1516
Scheduling
Lecture 4: Process
Scheduling
Basic Concepts
Scheduling Criteria
Scheduling Algorithms
Thread Scheduling
Multiple-Processor Scheduling
Objectives
To introduce process scheduling, which is
Basic Concepts
Maximum CPU utilization obtained with
multiprogramming
CPUI/O Burst Cycle Process execution
consists of a cycle of CPU execution and I/O
wait
CPU burst distribution
CPU Scheduler
Selects from among the processes in memory
Dispatcher
Dispatcher module gives control of the CPU
Scheduling Criteria
CPU utilization keep the CPU as busy as
possible
Throughput # of processes that complete
their execution per time unit
Turnaround time amount of time to execute a
particular process
Waiting time amount of time a process has
been waiting in the ready queue
Response time amount of time it takes from
when a request was submitted until the first
response is produced, not output (for timesharing environment)
P2
24
P3
27
30
P3
3
P1
6
30
Shortest-Job-First (SJF)
Scheduling
Example of SJF
ProcessBurst Time
P1
6
P2
8
P3
7
P4
3
SJF scheduling chart
P1
P4
0
P3
9
P2
16
24
Priority Scheduling
A priority number (integer) is associated with
each process
The CPU is allocated to the process with the
highest priority (smallest integer highest
priority)
Preemptive
Non preemptive
P2
4
P3
7
P1
10
P1
14
P1
18 22
P1
26
P1
30
Multilevel Queue
Ready queue is partitioned into separate queues:
foreground (interactive)
background (batch)
Each queue has its own scheduling algorithm
foreground RR
background FCFS
process
method used to determine when to demote a
process
method used to determine which queue a process
will enter when that process needs service
Scheduling
A new job enters queue Q0 which is served FCFS.
Thread Scheduling
Distinction between user-level and kernel-level
threads
Many-to-one and many-to-many models, thread
library schedules user-level threads to run on LWP
Known as process-contention scope (PCS) since
Multiple-Processor
Scheduling
available
Homogeneous processors within a multiprocessor
Asymmetric multiprocessing only one processor
accesses the system data structures, alleviating the
need for data sharing
Symmetric multiprocessing (SMP) each processor
is self-scheduling, all processes in common ready queue,
or each has its own private queue of ready processes
Processor affinity process has affinity for processor
on which it is currently running
soft affinity
hard affinity
Multicore Processors
Recent trend to place multiple processor
Multithreaded Multicore
System
End of Lecture 4
Slides adopted from the book:
Abraham Silberschatz, Peter Baer Galvin,
Greg Gagne, Operating System Concepts,
8/E, John Wiley & Sons, 2010. (ISBN: 978-0470-23399-3)