Lect 5
Lect 5
Bibhas Ghoshal IOSY 332C & IOPS 332C: OS Autumn Semester, 2019 1 / 24
Shortest Remaining Job First (SRJF)
Bibhas Ghoshal IOSY 332C & IOPS 332C: OS Autumn Semester, 2019 2 / 24
SRJF-Example
P1 P2 P4 P1 P3
0 1 5 10 17 26
Bibhas Ghoshal IOSY 332C & IOPS 332C: OS Autumn Semester, 2019 3 / 24
Numerical Example
Assume we have the following processes. Find out the finish time,
waiting time and turnaround time of each process for the following
scheduling algorithms: FCFS, SJF, SRJF.
Bibhas Ghoshal IOSY 332C & IOPS 332C: OS Autumn Semester, 2019 4 / 24
Numerical Example - FCFS
FCFS : Processes will run in the order they arrive. The following is
the completion, turnaround, waiting time of each process.
AT : Arrival Time ; BT : Burst Time
CT : Completion Time; TAT : Turnaround Time
WT : Waiting Time
AT BT CT TAT WT
A 0 30 30 30 0
B 5 20 50 45 25
C 10 12 62 52 40
D 15 10 72 57 47
Bibhas Ghoshal IOSY 332C & IOPS 332C: OS Autumn Semester, 2019 5 / 24
Numerical Example - SJF
AT BT CT TAT WT
A 0 30 30 30 0
B 5 20 72 67 47
C 10 12 52 42 30
D 15 10 40 25 15
Bibhas Ghoshal IOSY 332C & IOPS 332C: OS Autumn Semester, 2019 6 / 24
Numerical Example - SRJF
SRJF: running order will be: A(5) B(5) C(12) D(10) B(15) A(25)
AT : Arrival Time ; BT : Burst Time
CT : Completion Time; TAT : Turnaround Time
WT : Waiting Time
AT BT CT TAT WT
A 0 30 72 72 42
B 5 20 47 42 22
C 10 12 22 12 0
D 15 10 32 17 7
Bibhas Ghoshal IOSY 332C & IOPS 332C: OS Autumn Semester, 2019 7 / 24
Priority Scheduling
Bibhas Ghoshal IOSY 332C & IOPS 332C: OS Autumn Semester, 2019 8 / 24
Priority Scheduling - Example
Bibhas Ghoshal IOSY 332C & IOPS 332C: OS Autumn Semester, 2019 9 / 24
Round Robin (RR)
Bibhas Ghoshal IOSY 332C & IOPS 332C: OS Autumn Semester, 2019 10 / 24
Example of RR with Time Quantum = 4
P1 P2 P3 P1 P1 P1 P1 P1
0 4 7 10 14 18 22 26 30
Bibhas Ghoshal IOSY 332C & IOPS 332C: OS Autumn Semester, 2019 11 / 24
Example of RR with Time Quantum = 20
P1 P2 P3 P4 P1 P3 P4 P1 P3 P3
Bibhas Ghoshal IOSY 332C & IOPS 332C: OS Autumn Semester, 2019 12 / 24
Time Quantum and Context Switch Time
Bibhas Ghoshal IOSY 332C & IOPS 332C: OS Autumn Semester, 2019 13 / 24
Turnaround Time Varies With The Time Quantum
Bibhas Ghoshal IOSY 332C & IOPS 332C: OS Autumn Semester, 2019 14 / 24
Multilevel Queue
Bibhas Ghoshal IOSY 332C & IOPS 332C: OS Autumn Semester, 2019 15 / 24
Multilevel Queue
Bibhas Ghoshal IOSY 332C & IOPS 332C: OS Autumn Semester, 2019 16 / 24
Multilevel Feedback Queue
Bibhas Ghoshal IOSY 332C & IOPS 332C: OS Autumn Semester, 2019 17 / 24
Example of Multilevel Feedback Queue
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.
Bibhas Ghoshal IOSY 332C & IOPS 332C: OS Autumn Semester, 2019 18 / 24
Multilevel Feedback Queue
Bibhas Ghoshal IOSY 332C & IOPS 332C: OS Autumn Semester, 2019 19 / 24
Multiple-Processor Scheduling
Bibhas Ghoshal IOSY 332C & IOPS 332C: OS Autumn Semester, 2019 20 / 24
Real Time Scheduling
Bibhas Ghoshal IOSY 332C & IOPS 332C: OS Autumn Semester, 2019 21 / 24
Thread Scheduling
Bibhas Ghoshal IOSY 332C & IOPS 332C: OS Autumn Semester, 2019 22 / 24
Windows Xp Priorities
Bibhas Ghoshal IOSY 332C & IOPS 332C: OS Autumn Semester, 2019 23 / 24
Linux Scheduling
Bibhas Ghoshal IOSY 332C & IOPS 332C: OS Autumn Semester, 2019 24 / 24