Professional Documents
Culture Documents
CPU Scheduling
CPU Scheduling
Types of jobs
z
CPU Scheduler
z
z
z
Dispatcher
z
switching context
switching to user mode
jumping to the proper location in the user program to
restart that program
Scheduling Criteria
z
Optimization Criteria
z
z
z
z
z
z
z
P2
24
P3
27
30
P3
3
P1
6
30
Shortest-Job-First (SJR)
Scheduling
z
Example of Non-Preemptive
SJF
P3
7
Burst Time
7
4
1
4
P2
8
P4
12
16
P2
2
P3
4
P2
5
Burst Time
7
4
1
4
P1
P4
7
11
16
Properties of Exponential
Averaging
z
=0
z
n+1 = n
z Recent history does not count
=1
n+1 = tn
z Only the actual last CPU burst counts
If we expand the formula, each successive term has less
weight than its predecessor
z Recent history has more weight than old history
z
Priority Scheduling
z
Process
P1
P2
P3
P4
The Gantt chart is:
P1
0
P2
20
37
P3
P4
57
Burst Time
53
17
68
24
P1
77
P3
P4
P1
P3
P3
Multilevel Queue
z
foreground RR
background FCFS
number of queues
scheduling algorithms for each queue
method used to determine when to upgrade a 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
Three queues:
z
z
z
Scheduling
z