340 likes | 489 Vues
This study investigates the problem of minimizing total weighted flow time on a single machine with job preemptions. We address scenarios where jobs arrive at different times and possess distinct sizes and weights. The flow time of a job is defined as the time spent in the system from its release to completion, measured in terms of weighted flow time to keep user satisfaction high. The paper explores algorithms, including a novel strategy based on the Shortest Remaining Processing Time (SRPT), and evaluates the competitive ratios of various scheduling techniques.
E N D
Minimizing Weighted Flow Time Nikhil Bansal (CMU) Kedar Dhamdhere (CMU)
Scheduling What the heck is flowtime 1|r_j | pmtn | W_j F_j • Single Machine (with preemptions) • Jobs arrive at different times • Different sizes (service requirements) Keep users happy, some measure Nikhil Bansal
Scheduling (contd) t=0 Flow Time of Job 1 Flow Time = Completion Time – Release Time = Time spent in system Measure: Total Weighted Flow Time ( 1| rj, pmtn | wj Fj) Competitive Ratio = Max. [Online Cost / Opt. Offline Cost] Nikhil Bansal
Results Unweighted: Optimal’ 56 , SRPT (Shortest Rem. Proc. Time) P = max. size / min. size W= max. wt / min. wt Nikhil Bansal
Results (Resource Augmentation) s-speed c-competitive algorithm [Kalyanasundaram, Pruhs’ 95] Onlines(I) · c . Opt Offline1(I) Nikhil Bansal
An alternate view Weighted Flow Time of a job = wj£ (Time in system) think of contributing “wj” at each time step Total Wt. Flow Time W(t) = t Total weight(t) Local c-Competitive: If W(t) · c Wopt(t) for all t Clearly sufficient to guarantee c-competitive Also Necessary!! Need to keep total weight close to Opt at all times Nikhil Bansal
A Balancing Act Also need to take care of BIG weights Need to keep total weight close to Opt at all times Density = Weight/ Remaining Service Greedy could be very BAD (W = 99, Size = 100) W=1, Size =1 What happens at time 100 ? Nikhil Bansal
The Algorithm 1. Let the weights be w1 < w2 < … < wk 2. Put same weight jobs in a bucket. Work on the bucket with highest total weight (breaking ties in favor of the larger index). 3. Do SRPT within each bucket. W2=4 W1=1 Nikhil Bansal
The Algorithm 1. Let the weights be w1 < w2 < … < wk 2. Put same weight jobs in a bucket. Work on the bucket with highest total weight (breaking ties in favor of the larger index). 3. Do SRPT within each bucket. W2=4 W1=1 Nikhil Bansal
The Algorithm 1. Let the weights be w1 < w2 < … < wk 2. Put same weight jobs in a bucket. Work on the bucket with highest total weight (breaking ties in favor of the larger index). 3. Do SRPT within each bucket. W2=4 W1=1 Nikhil Bansal
The Algorithm 1. Let the weights be w1 < w2 < … < wk 2. Put same weight jobs in a bucket. Work on the bucket with highest total weight (breaking ties in favor of the larger index). 3. Do SRPT within each bucket. W2=4 W1=1 Nikhil Bansal
Analysis Idea Maintain an Invariant: Show does not change with time Simpler Problem: Optimality of SRPT (Shortest remaining processing time) wrt # of jobs: At all times SRPT has min # of jobs[Schrage’ 68] Nikhil Bansal
Proof SRPT Other SRPT(2) Other(2) Let A(l)= Jobs in the first l levels under A Let |A(l)| = Total work contained in jobs 2 A(l) Invariant:|Srpt(l)| ¸ |Other(l)| , for all l = 1,2,3,… If true, it follows NSRPT (t) · NOther(t) Nikhil Bansal
Proof (No arrival Case) SRPT Other SRPT always works on last job Nikhil Bansal
Proof (No arrival Case) SRPT Other |Srpt(l)| decreases! Key Property: |Srpt(l)| decreases iff |Srpt(l)| = total work Nikhil Bansal
Proof (Arrivals) SRPT Other Nikhil Bansal
Proof (Arrivals, Case 1) SRPT Other Nikhil Bansal
Proof (Arrivals) SRPT Other New |SRPT(5)| = Old |SRPT(4) | + |new arrival| New |Other(5)| = Old |Other(4) | + |new arrival| Nikhil Bansal
Proof (Arrivals) SRPT Other Easy: SRPT’s prefix only increases Nikhil Bansal
Our Algorithm • Let the weights be w1 < w2 < … < wk • Work on bucket with highest total weight (break ties in favor of the larger weight index) • Do SRPT within each bucket W2=4 W1=1 Nikhil Bansal
Proof Idea Let (j,l) denote lth job with weight wj B(j,l) = (j,l) [ {jobs which cannot be executed before (j,l) } 1) Key Property : |B(j,l)| decreases iff |B(j,l)| = total work 2) Weight(B(j,l)) · k . l . Wj W2=4 W1=1 (2,1) (2,2) (1,2) (1,5) B(1,5) Nikhil Bansal
Proof Idea P(j,l): Any packing of jobs with total weight · l £ wj Invariant: For every (j,l) packing, |B(j,l)| ¸ |P(j,l)| W2=4 W1=1 Opt un P(1,5) B(1,5) Nikhil Bansal
Proof Idea P(j,l): Any packing of jobs with total weight · l £ wj Invariant: For every (j,l) packing, |B(j,l)| ¸ |P(j,l)| W2=4 W1=1 Opt P(1,5) un B(1,5) Could have holes Nikhil Bansal
Invariant => Result Consider all jobs in Opt at time t. Total wt = W and min. wt = wj Let l = W/wj , and consider B(j,l) By Invariant, |B(j,l)| ¸ |P(j,l)| = total work in system B(j,l) = All the jobs Weight(B(j,l)) · k wj l = k Weight(Opt) Thus, K competitive Nikhil Bansal
Proof Idea P(j,l): Any packing of jobs with total weight · l £ wj Invariant: For every (j,l) packing, |B(j,l)| ¸ |P(j,l)| Key Property: |B(j,l)| decreases iff |B(j,l)| = total work W2=4 W1=1 Opt P(1,5) un B(1,5) Nikhil Bansal
Proving the Invariant (Arrival) W1=1 W2=4 More capacity here More elaborate argument: Presence of holes Want to show: B(1,5) >= P(1,5) on arrival Nikhil Bansal
Proving the Invariant W1=1 W2=4 On arrival of red job P(1,5) increases, but B(1,5) does not Need to use that in fact B(1,4) > P(1,4) A couple more cases! Nikhil Bansal
Open Problems • O(1) competitive for weighted flow time ? • O(1) approx ? • QPTAS, (nO(log W¢log P/^3)) time [Chekuri,Khanna] • 3) Non-clairvoyant case, better than 1+1/ • competitive for 1+ speed up ? Nikhil Bansal
Thank You! Nikhil Bansal
Proof Idea P(j,l): Any packing of jobs with total weight · l £ wj Invariant: For every (j,l) packing, |B(j,l)| ¸ |P(j,l)| W2=4 W1=1 Opt un P(1,5) B(1,5) Nikhil Bansal
Proof (Arrivals, Case 2) SRPT Other Nikhil Bansal
Proof (Arrivals, Case 2) SRPT Other Nikhil Bansal
Proof (Arrivals, Case 2) SRPT Other |Other(2)| might increase but |Srpt(2)| does not But, in SRPT first 2 jobs bigger than new (red) , not so for Other! Nikhil Bansal