Title: Minimizing Weighted Flow Time
1Minimizing Weighted Flow Time
- Nikhil Bansal (CMU)
- Kedar Dhamdhere (CMU)
2Scheduling
- Single Machine (with preemptions)
- Jobs arrive at different times
- Different sizes (service requirements)
Keep users happy, some measure
- What the heck is flowtime
- 1r_j pmtn W_j F_j
3Scheduling (contd)
t0
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
4Results
Unweighted Optimal 56 , SRPT (Shortest Rem.
Proc. Time)
Previous Results Our Results
NP Hard Lenstra, Kan, Brucker 77 O(Log2 P) compet. Semi-online Chekuri, Khanna, Zhu 01 k competitive for k weight classes gtO(Log W) competitive Truly online gt Semi-online O(log n log P)
P max. size / min. size W
max. wt / min. wt
5Results (Resource Augmentation)
s-speed c-competitive algorithm Kalyanasundaram,
Pruhs 95 Onlines(I) c
. Opt Offline1(I)
Previous Results Our Results
1? speed , 11/? compet. for clairvoyant weighted flow time Becchetti, Leonardi, Pruhs, Spaccamela 01 1? speed , 11/? compet. For non-clairvoyant unweighted flow time Kalyanasundaram,Pruhs 95 1? speed , 11/? compet. for non-clairvoyant weighted flow time
6An 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
7A Balancing Act
Need to keep total weight close to Opt at all
times
Density Weight/ Remaining Service
Greedy could be very BAD
(W 99, Size 100)
W1, Size 1
What happens at time 100 ?
- Also need to take care of BIG weights
8The Algorithm
- 1. Let the weights be w1 lt w2 lt lt 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.
W11
W24
9The Algorithm
- 1. Let the weights be w1 lt w2 lt lt 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.
W11
W24
10The Algorithm
- 1. Let the weights be w1 lt w2 lt lt 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.
W11
W24
11The Algorithm
- 1. Let the weights be w1 lt w2 lt lt 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.
W11
W24
12Analysis 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
13Proof
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)
14Proof (No arrival Case)
SRPT
Other
SRPT always works on last job
15Proof (No arrival Case)
SRPT
Other
Srpt(l) decreases!
Key Property Srpt(l) decreases iff Srpt(l)
total work
16Proof (Arrivals)
SRPT
Other
17Proof (Arrivals, Case 1)
SRPT
Other
18Proof (Arrivals)
SRPT
Other
New SRPT(5) Old SRPT(4) new arrival
New Other(5) Old Other(4) new arrival
19Proof (Arrivals)
SRPT
Other
Easy SRPTs prefix only increases
20Our Algorithm
- Let the weights be w1 lt w2 lt lt wk
- Work on bucket with highest total weight (break
ties in favor of the larger weight index) - Do SRPT within each bucket
W11
W24
21Proof 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
W11
W24
(2,1)
(2,2)
(1,2)
(1,5)
B(1,5)
22Proof 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)
W24
W11
Opt
un
P(1,5)
B(1,5)
23Proof 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)
W24
W11
Opt
P(1,5)
un
B(1,5)
Could have holes
24Invariant gt 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
25Proof 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
W24
W11
Opt
P(1,5)
un
B(1,5)
26Proving the Invariant (Arrival)
W11
W24
More capacity here
More elaborate argument Presence of holes
Want to show B(1,5) gt P(1,5) on arrival
27Proving the Invariant
W11
W24
On arrival of red job P(1,5) increases, but
B(1,5) does not Need to use that in fact B(1,4)
gt P(1,4) A couple more cases!
28Open Problems
- O(1) competitive for weighted flow time ?
- O(1) approx ?
- QPTAS, (nO(log Wlog P/?3)) time
Chekuri,Khanna - 3) Non-clairvoyant case, better than 11/?
- competitive for 1? speed up ?
29 30Proof 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)
W24
W11
Opt
un
P(1,5)
B(1,5)
31Proof (Arrivals, Case 2)
SRPT
Other
32Proof (Arrivals, Case 2)
SRPT
Other
33Proof (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!