Lecture 3 CPU Scheduling
Lecture 3 CPU Scheduling
Dep. of IT
Operating
Systems
Lecture 3: CPU
Scheduling
2019/2020 Prepared by: Dr. Rasha Bin-Thalab
Lecture Out Lines
2
Basic Concepts
Scheduling Criteria
Scheduling Algorithms
Thread Scheduling
Multiple-Processor Scheduling
Real-Time CPU Scheduling
Operating Systems Examples
Algorithm Evaluation
Basic Concepts
3
Scheduling Criteria
6
4. Priority Scheduling
0 3 6 30
Commonly, α set to ½
Preemptive version called shortest-remaining-time-
Example of Shortest-remaining-time-
13
first
Now we add the concepts of varying arrival times and
preemption to the analysis
ProcessA Arrival TimeT Burst Time
P1 0 8
P1 P2 P4 P1 P3
P2 1 4
0 1 5 10 17 26
P3 2 9
P4 3 5
Preemptive SJF Gantt Chart
Average waiting time = [(10-1)+(1-1)+(17-2)+5-3)]/4 =
26/4 = 6.5 msec
Priority Scheduling
14
background (batch)
background – 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