Академический Документы
Профессиональный Документы
Культура Документы
Systems
Lecture 15
Agenda for Today
Review of previous lecture
Shortest-job-first
Round-Robin scheduling
FCFS
14 September 2019 © Copyright Virtual University of
Pakistan
Shortest-Job-First (SJF)
Scheduling
Process with the shortest CPU
burst is scheduled first.
Non-preemptive – once CPU
given to a process it cannot be
preempted until completes its
CPU burst.
14 September 2019 © Copyright Virtual University of
Pakistan
Shortest-Job-First (SJF)
Scheduling
Preemptive – if a new process arrives
with CPU burst length less than
remaining time of current executing
process, preempt it—Shortest-
Remaining-Time-First (SRTF).
SJF is optimal non-preemptive
scheduling algorithm – gives minimum
average waiting time for a given set of
processes.
14 September 2019 © Copyright Virtual University of
Pakistan
Non-Preemptive SJF
Process Arrival Time Burst Time
P1 0.0 7
P2 2.0 4
P3 4.0 1
P4 5.0 4
Gantt chart P P P 1P 3 2 4
0 7 12 16
0 2 4 5 7 11 16
14Average
September 2019
waiting time = (9 + 1
© Copyright Virtual University of
+ 0 +2)/4 = 3
Pakistan
SJF—CPU Burst of a
Process
Can only estimate the length
of the next CPU burst.
Can be done by using the
length of previous CPU
bursts, using exponential
averaging.
14 September 2019 © Copyright Virtual University of
Pakistan
Exponential Averaging
estimate is
Priority scheduling
Recap of lecture
14 September 2019 © Copyright Virtual University of
Pakistan