Energy Efficient Flow Time Scheduling Prudence Wong University 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 Previous flow time + energy work & summary of results Algorithm and ideas of analysis Active Job Count (AJC) Potential analysis Concluding CTAG Seminar 2008.10.30 remarks Energy Efficient Flow Time Scheduling Pentium M spec (1.6 GHz) f 1.6 GHz 0.6 GHz IBM Processor V 1.484 V 0.956 V P 24.5 W 6W PowerPC 970FX CTAG Seminar 2008.10. 30 Speed Scaling Functions for Flow Time Scheduling based on Active Job Count Energy Efficiency For mobile devices, energy efficiency is a major concern. How to save energy? Dynamic speed (voltage) scaling Slow To down processor whenever possible 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 s=1 0 1 2 time energy: 13 × 2 = 2 energy: 23 × 1 = 8 s=2 0 1 2 time energy: (2/3)3 x (3/2) + 23 x 1/2 s = 2/3 &s=2 0 1 2 time = 40/9 slower speed saves energy same speed over same interval saves energy CTAG Seminar 2008.10.30 Energy Efficient Flow Time Scheduling Orthogonal Objectives Energy efficiency: run jobs slower Quality of service: run jobs faster Examples of QoS 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 time CTAG 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 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: each Online jobs arriving at arbitrary times with some work to complete 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 CTAG Seminar 2008.10.30 speed vs bounded speed model Energy Efficient Flow Time Scheduling Example Assume α=2 speed s=1 0 1 S1 Energy E Flow F J 12x1=1 1 2 0.52x2=0.5 2 2.5 speed J S2 s = 0.5 J Schedule S1 is better than S2 CTAG Seminar 2008.10.30 E+F Energy Efficient Flow Time Scheduling Example Assume 0 α=2 1 2 J1 J2 E(S2) – E(S1) = -0.25 speed s = 1.25 F(S2)-F(S1) = 0.4 S1 J1 s=1 J2 depends on overlap speed of span of jobs s=1 we don't know S2 J1 efficient optimal offline algorithm CTAG Seminar 2008.10.30 Energy Efficient Flow Time Scheduling J2 r(J1) = 0 p(J1) = 1 r(J2) = 0.8 p(J2) = 1 best schedule flow time inc too much Best Speed for a Single Job Given a job of size p Suppose we run the job at speed s = sα(p/s) = sα-1p & F = p/s E + F = p(sα-1 + 1/s) E 1 1 α ) Differentiating, min E+F when s = ( α −1 When we have n jobs (different sizes), 1 critical threshold n ( CTAG Seminar 2008.10.30 α −1 )α Energy Efficient Flow Time Scheduling 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] job selection: SJF (shortest job first) Speed: function of remaining work Infinite speed model Bounded speed model CTAG Seminar 2008.10.30 preemption α = 2 α = 3 AF >150 >400 BPS 5.236 7.940 BPS 10.472 with max speed 1.618T 11.910 with max speed 1.466T Energy Efficient Flow Time Scheduling BPS Algorithm BPS-fractional Speed w1/αα, w is ∑fraction of jobs remained BPS (use SJF) (with speed advantage 1+εε) Simulate BPS-F; same job; speed (1+ε (1+ε) faster idle if simulated schedule runs a job we finish J1 J2 J4 J3 speed schedule CTAG Seminar 2008.10.30 J1 J2 J1 J J 3 Energy4 Efficient Flow Time Scheduling BPS Algorithm Somewhat strange schedule? continuously changing speed, sometimes lazy required extra speed in bounded speed model 1 speed may be lower than threshold n α ( ) α −1 not applicable in non-clairvoyant model, where job size is unknown on arrival J1 J2 J4 J3 speed schedule CTAG Seminar 2008.10.30 J1 J2 J1 J J 3 Energy4 Efficient Flow Time Scheduling Our Contribution SRPT+AJC (active job count) shortest remaining processing time β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 Infinite speed model α = 2 α = 3 BPS 5.236 7.940 AJC 2.667 3.252 10.472 with max speed 1.618T 11.910 with max speed 1.466T 3.6 with max speed T 4 with max speed T Bounded speed BPS model AJC Non-clairvoyant scheduling, batched case: (2-1/α)-comp & 2-comp CTAG Seminar 2008.10.30 Energy Efficient Flow Time Scheduling SRPT-AJC (infinite speed) SRPT: run the job with the smallest remaining work run at speed n1/αα, where n is current number of jobs AJC: J1 J2 J4 AJC is more stable than BPS & can also be used in nonclairvoyant case J3 speed S J1 CTAG Seminar 2008.10.30 J2 J4 J3 Energy Efficient Flow Time Scheduling 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 arrival: Φ not increase when job arrives completion: Φ not increase when job finish dGo(t ) running: dGa (t ) dΦ (t ) + −β ≤0 dt dt dt Implies: CTAG Seminar 2008.10.30 SRPT-AJC is β-competitive Energy Efficient Flow Time Scheduling Amortized Local Competitive Let t1, t2, …, t3n be the time when a job is released; online algorithm completes a job; OPT completes a job dGa (t ) dΦ (t ) dGo(t ) + −β ≤0 Integrating over time dt dt dt we get 3 n +1 Ga + ∑ ∆Φ (ti ) ≤ βGo i =1 By arrival & completion condition we By get Ga + Φ(∞ ∞) – Φ(0) ≤βG ≤β o boundary condition, Ga ≤ βGo CTAG Seminar 2008.10.30 Energy Efficient Flow Time Scheduling Potential Function Let na(q) & no(q) be # of jobs with remaining work ≥ q in SRPT-AJC & OPT n(q) q1 If no more new jobs, E+F = 2 ∫ ∞ 0 Smallest remaining work: q1 Run one such job: speed = n1/αα -1/α α time to finish = q n q 1 -1/α α E = n (q1 n ) = n1-1/αα q1 F = n (q1 n-1/αα) = n1-1/αα q1 n ( q ) 1−1/ α na ( q ) ∑ i dq φ (q ) = i1−1/ α − n (q )1−1/ α n (q ) a o ∑ i =1 i =1 ∞ CTAG Seminar 2008.10.30 for arrival condition Φ (t ) = β ∫ φ (q ) dq 0 Energy Efficient Flow Time Scheduling Bounded Speed Model AJC speed at min {T, n1/αα}, where T is max allowable speed A similar potential function but with a different β dGa(t ) dΦ(t ) dGo(t ) dt + dt −β dt na ( q ) 1−1/ α − na (q )1−1/ α no (q ) φ (q) = ∑ i i =1 ∞ Φ (t ) = β ∫ φ (q ) dq 0 CTAG Seminar 2008.10.23 Energy Efficient Flow Time Scheduling ≤0 Non-Clairvoyant Model Online algorithm doesn't know the job size when it is released 1 n α AJC*: Run at speed ( α − 1) Run all active jobs simultaneously (by time sharing) RR-AJC*: 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/α α)-competitive CTAG 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 Combining with RR (round robin) gives constant competitiveness for nonclairvoyant scheduling of batched jobs CTAG Seminar 2008.10.30 Energy Efficient Flow Time Scheduling Future Work scheduling of jobs with arbitrary arrival times Non-clairvoyant 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