2 3 Process-Scheduling
2 3 Process-Scheduling
Endadul Hoque
Acknowledgement
0 20 40 60 80 100 120
Time (Second)
𝟏𝟎 + 𝟐𝟎 + 𝟑𝟎
𝑨𝒗𝒆𝒓𝒂𝒈𝒆 𝒕𝒖𝒓𝒏𝒂𝒓𝒐𝒖𝒏𝒅 𝒕𝒊𝒎𝒆 = = 𝟐𝟎 𝒔𝒆𝒄
𝟑
Why is FIFO not that great? – Convoy effect
src: https://www.moveoverslowdrivers.com/speed-up-slowpoke-or-get-a-ticket/
Why is FIFO not that great? – Convoy effect
0 20 40 60 80 100 120
Time (Second)
B C A
0 20 40 60 80 100 120
Time (Second)
𝟏𝟎 + 𝟐𝟎 + 𝟏𝟐𝟎
𝑨𝒗𝒆𝒓𝒂𝒈𝒆 𝒕𝒖𝒓𝒏𝒂𝒓𝒐𝒖𝒏𝒅 𝒕𝒊𝒎𝒆 = = 𝟓𝟎 𝒔𝒆𝒄
𝟑
SJF with Late Arrivals from B and C
• Let’s relax assumption 2: Jobs can arrive at any time.
• Example:
– A arrives at t=0 and needs to run for 100 seconds.
– B and C arrive at t=10 and each need to run for 10 seconds
[B,C arrive]
A B C
0 20 40 60 80 100 120
Time (Second)
[B,C arrive]
A B C A
0 20 40 60 80 100 120
Time (Second)
A B CA B CA B CA B CA B C
0+1+2
𝑇𝑎𝑣𝑒𝑟𝑎𝑔𝑒 𝑟𝑒𝑠𝑝𝑜𝑛𝑠𝑒 = = 𝟏𝒔𝒆𝒄
3
0 5 10 15 20 25 30
Time (Second)
RR with a time-slice of 1sec (Good for Response Time)
The length of the time slice is critical
• The shorter time slice
– Better response time
– The cost of context switching will dominate overall
performance.
A B A B A B A B A B
Maximize the
CPU utilization