Scheduling
Scheduling
Why?
- Why not do it only at FS/DD level?
- Why not do it only within the disk?
Scheduling at Multiple
Locations!
Why?
Key ideas that disk scheduling employs:
Request re-ordering for seek/positioning
minimization
Exploit temporal locality
Anticipation for sequential streams
Introduce non-work conserving behavior!
Exploit spatial locality
Coalesce consecutively placed requests
Free-block scheduling
Different optimizations are best done at
different locations
Furthermore, the best location to do an
optimization depends on the workload!
Goals
– Short response time
– High overall throughput
– Fairness (equal probability for all
blocks to be accessed in the same
time)
cylinder number
ming requests (in order of arrival): 1 5 10 15 20 25
12 14 2 7 21 8 24
time
Shortest Seek Time
First (SSTF)
SSTF serves closest request first:
short seek times
longer maximum seek times – may lead to starvation
cylinder number
1 5 10 15 20 25
ming requests (in order of arrival):
12 14 2 7 21 8 24
time
SCAN
SCAN moves head edge to edge and serves requests on the way
bi-directional
compromise between response time and seek time optimizati
cylinder number
1 5 10 15 20 25
ming requests (in order of arrival):
12 14 2 7 21 8 24
time
C–SCAN
Circular-SCAN moves head from edge to edge
serves requests on one way – uni-directional
improves response time (fairness)
cylinder number
1 5 10 15 20 25
ming requests (in order of arrival):
12 14 2 7 21 8 24
time
LOOK and C–LOOK
LOOK (C-LOOK) is a variation of SCAN (C-SCAN):
same schedule as SCAN
does not run to the edges
stops and returns at outer- and innermost request
increased efficiency
ming requests (in order of arrival):
cylinder number
1214 2 7 21 8 24 1 5 10 15 20 25
time
V–SCAN(R)
V-SCAN(R) combines SCAN (or LOOK) and SSTF
– define a R-sized unidirectional SCAN window,
i.e., C-SCAN, and use SSTF outside the window
– Example: V-SCAN(0.6)
• makes a C-SCAN (C-LOOK) window over 60 % of the
cylinders
uses SSTF for requests outside the window
Host interface
Data layout
On-Board Cache
Ref: B.L. Worthington, Greg Ganger, N. Patt : Scheduling Algorithms for Modern
Disk Drives ACM Sigmetrics 1994
Host interface
As W
increases, the
average
response time
slowly grows,
though
variance drops
Scheduling with Full
Knowledge
Modern Disk
Scheduling
In modern drives, C-LOOK best exploits the
prefetching cache for workloads with significant
read sequentiality
tim
e
s ee
k
location on
disk
Throughput = 21 MB/s (IBM Deskstar d
With synchronous
I/O…
issued by process
too
A issued by process B
lat
e!
forced
!
schedu forced
le !
but
Next
Anticipatory
scheduling
Key idea: Sometimes wait for process
whose request was last serviced.
Thinktim
Median 95percentilee
last nex
t
Cost-benefit analysis
for seek optimizing
scheduler
best := best available request chosen by
scheduler
next := expected forthcoming request from
process whose request was last serviced
Benefit =
best.positioning_time — next.positioning_time
Cost = next.median_thinktime
Waiting_duration =
(Benefit > Cost) ? next.95percentile_thinktime : 0
Proportional
scheduler
Costs and benefits are different.
Waiting_duration = next.95percentile_thinktime
Prefetch
Overlaps computation with I/O.
Side-effect:
avoids deceptive idleness!
Application-driven
Kernel-driven
Conclusion
Anticipatory scheduling:
Tail of response time distribution with Tail of response time distribution with
average load of 16 outstanding requests and average load of 16 outstanding requests and
threshold of 8 threshold of 16
Observations ..
Majority of requests under FCFS exhibit long
response times, while seek-reducing algorithms
result in majority of short response times
15
no prefetch
prefetch
10
no prefetch
prefetch
0
Sequential Alternate Random within file
Real workloads
What’s the impact on real applications
and benchmarks?
20 Original
15 Anticipatory
10
5
Execution
0 time (minutes)
mkdir cp stat scan gcc
-16% -5% -5% -54% +1.7%
3
• CS.Berkeley trace
2
• Large working set
• 48 web clients 1
Throughput (MB/s)
0
read mmap
+29% +71%
no
prefetch