Professional Documents
Culture Documents
Lesson 4 - CPU Scheduling
Lesson 4 - CPU Scheduling
Lesson 4 - CPU Scheduling
Basic Concepts
Scheduling Criteria
Scheduling Algorithms
Multiple-Processor Scheduling
Real-Time Scheduling
Algorithm Evaluation
P1 P2 P3
0 24 27 30
Waiting time for P1 = 0; P2 = 24; P3 = 27
Average waiting time: (0 + 24 + 27)/3 = 17
0 3 6 30
P1 P3 P2 P4
0 3 7 8 12 16
Average waiting time = (0 + 6 + 3 + 7)/4 - 4
Operating System Concepts
Example of Preemptive SJF
P1 P2 P3 P2 P4 P1
0 2 4 5 7 11 16
Average waiting time = (9 + 1 + 0 +2)/4 - 3
Operating System Concepts
Determining Length of Next
CPU Burst
Can only estimate the length.
Can be done by using the length of previous CPU bursts,
using1.exponential of nthCPU burst
averaging.
tn actual lenght
2. n 1 predicted value for the next CPU burst
3. , 0 1
4. Define :
n 1 tn 1 n .
P1 P2 P3 P4 P1 P3 P4 P1 P3 P3
Typically,
0 20 higher
37 average
57 turnaround
77 97 117than 121
SJF, but
134better
154 162
response.