CPU Scheduling1
CPU Scheduling1
PROCESS CONCEPT
Program counter
CPU registers
Memory-management information
Accounting information
Scheduling Algorithms
Thread Scheduling
Multiple-Processor Scheduling
Algorithm Evaluation
OBJECTIVES
To introduce CPU scheduling, which is the basis for
multiprogrammed operating systems
To describe various CPU-scheduling algorithms
0 24 27 30
Waiting time for P1 = 0; P2 = 24; P3 = 27
Average waiting time: (0 + 24 + 27)/3 = 17
FCFS SCHEDULING (CONT)
Suppose that the processes arrive in the order
P2 , P3 , P1
The Gantt chart
P2 for the
P3 schedule is: P1
0 3 6 30
0 3 9 16 24
P1 P2 P3 P1 P1 P1 P1 P1
0 4 7 10 14 18 22 26 30
Three queues:
Q0 – RR with time quantum 8 milliseconds
Q1 – RR time quantum 16 milliseconds
Q2 – FCFS
Scheduling
A new job enters queue Q0 which is served FCFS. When it
gains CPU, job receives 8 milliseconds. If it does not finish
in 8 milliseconds, job is moved to queue Q1.
At Q1 job is again served FCFS and receives 16 additional
milliseconds. If it still does not complete, it is preempted and
moved to queue Q2.
MULTILEVEL FEEDBACK QUEUES
MULTIPLE-PROCESSOR SCHEDULING
CPU scheduling more complex when multiple
CPUs are available
Homogeneous processors within a multiprocessor