Energy Efficient Flow Time Scheduling
Prudence WongPrudence WongUniversity of Liverpool
CTAG Seminar
Joint work with Tak-Wah LAM, Lap-Kei LEE (U of Hong Kong)Isaac K.K. TO (Liverpool)
Appeared in ESA 2008
Outline�Minimizing flow time + energy
�Previous work & summary of results
�Algorithm and ideas of analysis� Active Job Count (AJC)� Active Job Count (AJC)
� Potential analysis
�Concluding remarks
CTAG Seminar 2008.10.30 Energy Efficient Flow Time Scheduling
Processor�Pentium M spec (1.6 GHz)
�IBM PowerPC 970FX
f V P
1.6 GHz 1.484 V 24.5 W
0.6 GHz 0.956 V 6 W
CTAG Seminar 2008.10. 30Speed Scaling Functions for Flow Time Scheduling
based on Active Job Count
Energy EfficiencyFor mobile devices, energy efficiency is
a major concern.
How to save energy? Dynamic speed (voltage) scaling
�Slow down processor whenever possible
�To run at speed s, power = sα where α>1(literature: α = 2 or 3)
CTAG Seminar 2008.10.30 Energy Efficient Flow Time Scheduling
Examples�Assume α = 3, a job with work = 2
time0 1 2
time
energy: 13 × 2 = 2
energy: 23 × 1 = 8
s = 1
s = 2
CTAG Seminar 2008.10.30 Energy Efficient Flow Time Scheduling
time0 1 2
time0 1 2
energy: (2/3)3 x (3/2) + 23 x 1/2
= 40/9
� slower speed saves energy� same speed over same interval saves energy
s = 2/3 & s = 2
Orthogonal Objectives�Energy efficiency: run jobs slower
�Quality of service: run jobs faster
�Examples of QoS� deadline feasibility, flow time, etc� deadline feasibility, flow time, etc
�In previous talks: deadline feasibility� a job has an arrival time a, deadline d,
amount of work w
� slowest possible speed w/(d-a)
�This time: flow timeCTAG Seminar 2008.10.30 Energy Efficient Flow Time Scheduling
Flow time�Flow time: time elapsed from release to
complete
�We want: small flow time, small energy
�Objective: minimize F+E [Albers and �Objective: minimize F+E [Albers and Fujiwara '06]
� minimize F subject to a bounded E?�unfortunately, there is no O(1)-competitive
online algorithm
CTAG Seminar 2008.10.30 Energy Efficient Flow Time Scheduling
Online Scheduling�Input: jobs arriving at arbitrary times
�each with some work to complete
�Online scheduling� learn about a job only when it is released
� decide which job to run and at what speed
�Competitive analysis� worst case ratio of F+E of online algorithm
to that of optimal algorithm
�Infinite speed vs bounded speed modelCTAG Seminar 2008.10.30 Energy Efficient Flow Time Scheduling
Example�Assume α = 2
J
speed
J0 1
speed
Energy E Flow F E+F
12x1=1 1 2S1
s = 1
CTAG Seminar 2008.10.30 Energy Efficient Flow Time Scheduling
J
s = 0.5
speed
J 0.52x2=0.5 2 2.5S2
Schedule S1 is better than S2
Example�Assume α = 2
J1
J2
0 1 2
speed
best s = 1.25 s = 1
r(J1) = 0 p(J1) = 1
r(J2) = 0.8 p(J2) = 1
E(S2) – E(S1) = -0.25
F(S2)-F(S1) = 0.4
CTAG Seminar 2008.10.30 Energy Efficient Flow Time Scheduling
J1
best scheduleJ2
s = 1.25 s = 1
speed
J1 J2
s = 1 flow time inc too much
S1
S2
F(S2)-F(S1) = 0.4
� depends on overlap of span of jobs
� we don't know efficient optimal offline algorithm
Best Speed for a Single Job�Given a job of size p
�Suppose we run the job at speed s
�E = sα(p/s) = sαααα-1p & F = p/sE + F = p(sαααα-1 + 1/s)E + F = p(sαααα-1 + 1/s)
�Differentiating, min E+F when s =
�When we have n jobs (different sizes), critical threshold
CTAG Seminar 2008.10.30 Energy Efficient Flow Time Scheduling
α
α
1
)1
1(
−
α
α
1
)1
(−
n
Previous Work�Unit size jobs [Albers and Fujiwara STACS 06]
� Speed function: (n/c)1/αααα, c is constant
� Competitive ratio 8.3e(1+Φ)αααα, Φ is golden ratio
�Arbitrary size [Bansal, Pruhs, Stein SODA 07]Arbitrary size � job selection: SJF (shortest job first)
� Speed: function of remaining work
CTAG Seminar 2008.10.30 Energy Efficient Flow Time Scheduling
αααα = 2 αααα = 3
Infinite speed model
AF >150 >400
BPS 5.236 7.940
Bounded speed model
BPS 10.472 with max speed 1.618T
11.910 withmax speed 1.466T
preemption
BPS Algorithm�BPS-fractional (use SJF)
� Speed w1/αααα, w is ∑fraction of jobs remained
�BPS (with speed advantage 1+εεεε)� Simulate BPS-F; same job; speed (1+εεεε) faster
Energy Efficient Flow Time Scheduling
Simulate BPS-F; same job; speed (1+ ) faster� idle if simulated schedule runs a job we finish
CTAG Seminar 2008.10.30
J1J2
J3J4
speed
scheduleJ1 J2 J1 J4 J3
BPS Algorithm�Somewhat strange schedule?
� continuously changing speed, sometimes lazy
� required extra speed in bounded speed model�speed may be lower than threshold
� not applicable in non-clairvoyant model, where
α
α
1
)1
(−
n
Energy Efficient Flow Time Scheduling
� not applicable in non-clairvoyant model, where job size is unknown on arrival
CTAG Seminar 2008.10.30
J1J2
J3J4
speed
scheduleJ1 J2 J1 J4 J3
Our Contribution�SRPT+AJC (active job count)
� β1- & β2-comp for infinite & bounded speed�β1= 2/(1- (α-1)/αα/(α-1)) → 2α/ln α
�β2= 2(α+1)/(α-(α-1)/(α+1)1/(α-1)) → 2α/ln α
�N.B.: µεγ1, µεγ2 → 2(α/ln α)2
shortest remaining processing time
CTAG Seminar 2008.10.30 Energy Efficient Flow Time Scheduling
�N.B.: µεγ1, µεγ2 → 2(α/ln α)
�Non-clairvoyant scheduling, batched case: (2-1/α)-comp & 2-comp
αααα = 2 αααα = 3
Infinite speed model
BPS 5.236 7.940
AJC 2.667 3.252
Bounded speed model
BPS 10.472 with max speed 1.618T 11.910 with max speed 1.466T
AJC 3.6 with max speed T 4 with max speed T
SRPT-AJC (infinite speed)�SRPT: run the job with the smallest
remaining work
�AJC: run at speed n1/αααα, where n is current number of jobs
CTAG Seminar 2008.10.30 Energy Efficient Flow Time Scheduling
J1J2
J3J4
J1 J2 J4 J3
speed
S
AJC is more stable than BPS & can also
be used in non-clairvoyant case
Potential & Amortization�Let Ga(t) & Go(t) be current F+E of
SRPT-AJC & OPT, resp.
�We show a potential function ΦΦΦΦ(t) and a value ββββ s.t. following conditions hold
boundary: (0) & ( ) are non-negative� boundary: ΦΦΦΦ(0) & ΦΦΦΦ(∞∞∞∞) are non-negative
� arrival: ΦΦΦΦ not increase when job arrives
� completion: ΦΦΦΦ not increase when job finish
� running:
�Implies: SRPT-AJC is β-competitiveCTAG Seminar 2008.10.30 Energy Efficient Flow Time Scheduling
0dt
)(d
dt
)(d
dt
)(d≤−
Φ+
tGttG oaβ
Amortized Local Competitive�Let t1, t2, …, t3n be the time when
� a job is released; online algorithm completes a job; OPT completes a job
�Integrating over timewe get
0dt
)(d
dt
)(d
dt
)(d≤−
Φ+
tGttG oaβ
� we get
�By arrival & completion condition� we get Ga + ΦΦΦΦ(∞∞∞∞) – ΦΦΦΦ(0) ≤β≤β≤β≤βGo
�By boundary condition, Ga ≤≤≤≤ ββββGoCTAG Seminar 2008.10.30 Energy Efficient Flow Time Scheduling
dtdtdt
o
n
i
ia GtG β≤∆Φ+∑+
=
13
1
)(
Potential Function�Let na(q) & no(q) be # of jobs with
remaining work ≥ q in SRPT-AJC & OPTn(q) Smallest remaining work: q1
Run one such job:� speed = n1/αααα
� time to finish = q n-1/αααα
CTAG Seminar 2008.10.30 Energy Efficient Flow Time Scheduling
qq1
� time to finish = q1 n-1/αααα
� E = n (q1 n-1/αααα) = n1-1/αααα q1
� F = n (q1 n-1/αααα) = n1-1/αααα q1If no more new jobs,
E+F = qiqn
i
d20
)(
1
/11
∫ ∑∞
=
−
α)()()(
/11)(
1
/11qnqniq oa
qn
i
a
ααφ −
=
− −
= ∑
qqt d)()(0∫∞
=Φ φβfor arrival condition
Bounded Speed Model�AJC
� speed at min {T, n1/αααα}, where T is max allowable speed
�A similar potential function but with a different βdifferent β
CTAG Seminar 2008.10.23 Energy Efficient Flow Time Scheduling
0dt
)(d
dt
)(d
dt
)(d≤−
Φ+
tGttG oaβ
)()()(/11
)(
1
/11qnqniq oa
qn
i
a
ααφ −
=
− −
= ∑
qqt d)()(0∫∞
=Φ φβ
Non-Clairvoyant Model�Online algorithm doesn't know the job
size when it is released
�AJC*: Run at speed
�RR-AJC*: Run all active jobs
α
α
1
)1
(−
n
�RR-AJC*: Run all active jobs simultaneously (by time sharing)
�Analysis for batched case: two steps� E+F of RR-AJC* ≤ (2-1/αααα) E+F of SJF-AJC*
� SJF-AJC* is optimal
⇒RR-AJC* is (2-1/αααα)-competitiveCTAG Seminar 2008.10.23 Energy Efficient Flow Time Scheduling
Summary�We proposed a more stable speed
function AJC
�Combining AJC with SRPT improves the competitive ratios of BPS
Energy Efficient Flow Time Scheduling
�Combining with RR (round robin) gives constant competitiveness for non-clairvoyant scheduling of batched jobs
CTAG Seminar 2008.10.30
Future Work�Non-clairvoyant scheduling of jobs
with arbitrary arrival times
�Energy efficient multi-processor flow time scheduling
�Save energy by scaling speed and let processor go to a sleep state
�Other quality of service
�Other practical considerations� switching overhead
CTAG Seminar 2008.10.23 Energy Efficient Flow Time Scheduling