1 Server Scheduling in the L p norm Nikhil Bansal (CMU) Kirk Pruhs (Univ. of Pittsburgh)

41
1 Server Scheduling in the L p norm Nikhil Bansal (CMU) Kirk Pruhs (Univ. of Pittsburgh)

Transcript of 1 Server Scheduling in the L p norm Nikhil Bansal (CMU) Kirk Pruhs (Univ. of Pittsburgh)

Page 1: 1 Server Scheduling in the L p norm Nikhil Bansal (CMU) Kirk Pruhs (Univ. of Pittsburgh)

1

Server Scheduling in the Lp norm

Nikhil Bansal (CMU)Kirk Pruhs (Univ. of Pittsburgh)

Page 2: 1 Server Scheduling in the L p norm Nikhil Bansal (CMU) Kirk Pruhs (Univ. of Pittsburgh)

2

Scheduling

Provide service such that users are satisfied

Page 3: 1 Server Scheduling in the L p norm Nikhil Bansal (CMU) Kirk Pruhs (Univ. of Pittsburgh)

3

Motivation

Single MachineArbitrary arrival or release time ( rj)

Arbitrary processing requirement or size ( pj)

t=0 (r1) r2

r3

Page 4: 1 Server Scheduling in the L p norm Nikhil Bansal (CMU) Kirk Pruhs (Univ. of Pittsburgh)

4

Motivation

t=0 (r1) r2

r3

c2 c3c1

Job 1 preempted

Single MachineArbitrary arrival or release time ( rj)

Arbitrary processing requirement or size ( pj)

Page 5: 1 Server Scheduling in the L p norm Nikhil Bansal (CMU) Kirk Pruhs (Univ. of Pittsburgh)

5

Flow Time

t=0 (r1) r2

r3

c2 c3c1

Completion time: cj

Flow time: fj = cj-rj (time user waits)

Flow Time of Job 1

Page 6: 1 Server Scheduling in the L p norm Nikhil Bansal (CMU) Kirk Pruhs (Univ. of Pittsburgh)

6

Flow Time

t=0 (r1) r2

r3

c2 c3c1

Completion time: cj

Flow time: fj = cj-rj (time user waits)

Flow Time of Job 3

Page 7: 1 Server Scheduling in the L p norm Nikhil Bansal (CMU) Kirk Pruhs (Univ. of Pittsburgh)

7

Stretch

Stretch (i) = Flow time (i) / Size (i) [Bender Chakrabarti Muthukrishnan’98]

Jobs willing to tolerate flow time proportional to size

Also known as normalized flow timeEach job contributes equally

Page 8: 1 Server Scheduling in the L p norm Nikhil Bansal (CMU) Kirk Pruhs (Univ. of Pittsburgh)

8

Known Results

Minimize total flow time (i fi) [L1 norm]

Optimal Online algorithm:Work on job with smallest remaining proc. time

(SRPT)

SRPT is 2 – competitive for total stretch [Gehrke,

Muthukrishnan, Rajaraman, Shaheen’99]Concern: Big jobs could be stuck! Starvation!

Another end: Minimize maximum flow time [L1 norm]

First Come First Served (FCFS) is optimal But bad average performance [Smalls stuck behind

big]

Page 9: 1 Server Scheduling in the L p norm Nikhil Bansal (CMU) Kirk Pruhs (Univ. of Pittsburgh)

9

Balancing average and maximum Lp norms: Penalize outliers, good average

performance

Online algorithms for minimizing1) Flow time (i.e. (j fj

p)1/p)

2) Stretch (i.e. (j sjp)1/p)

Lp norms, previously studied: Load balancing [Awerbuch Azar Grove+ ’95, Alon Azar

Woeginger Yadid ’97, Avidor Azar Sgall ’01] Completion time scheduling [Epstein,Sgall’99]

Page 10: 1 Server Scheduling in the L p norm Nikhil Bansal (CMU) Kirk Pruhs (Univ. of Pittsburgh)

10

Lower Bound

L3 jobs of size 1

By time L3 ,If do not finish size L job, bad!

Size L

Online: Cost of big (L3)2 = L6

Opt: L3 Smalls delayed by L= O(L5)

No no(1) competitive randomized alg for Lp norms offlow time and stretch, for 1<p<1

SRPT, FCFS optimal algorithms for p=1, 1

Suppose p=2

Page 11: 1 Server Scheduling in the L p norm Nikhil Bansal (CMU) Kirk Pruhs (Univ. of Pittsburgh)

11

Lower Bound

No no(1) competitive randomized alg for Lp norms offlow time and stretch, for 1<p<1

SRPT, FCFS optimal algorithms for p=1, 1

L3 jobs of size 1

By time L3 ,If do not finish size L job, bad!

L5 jobs of size 1/L2

Optional Stream of jobsSize L

Page 12: 1 Server Scheduling in the L p norm Nikhil Bansal (CMU) Kirk Pruhs (Univ. of Pittsburgh)

12

Results

Thm: SRPT, SJF (Shortest Job First) are 1+ speed O(1/) competitive

Resource Augmentation: [Kalyanasundaram, Pruhs 95]

Online has more resourcess-speed, c-competitive maxI Online(I,s) / Opt(I,1) · c

No starvation unless close to peak capacity

Page 13: 1 Server Scheduling in the L p norm Nikhil Bansal (CMU) Kirk Pruhs (Univ. of Pittsburgh)

13

Interpreting Resource Augmentation

Load

Perf

orm

ance

Optimal

Page 14: 1 Server Scheduling in the L p norm Nikhil Bansal (CMU) Kirk Pruhs (Univ. of Pittsburgh)

14

Interpreting Resource Augmentation

Load

Perf

orm

ance

Optimal

Online

Page 15: 1 Server Scheduling in the L p norm Nikhil Bansal (CMU) Kirk Pruhs (Univ. of Pittsburgh)

15

Proof Sketch

Lp norm of flow time as ‘weighted’ Flow Time problem Age(j,t) = 0 if t<rj or t>cj

t-rj if rj < t < cj

Observation: fj2/2 = t age(j,t)

j fj2 /2= t j: alive at time t age(j,t)

Proof idea: Show, at all times total age of alive jobs < O(1/ )¢ total age under Opt

Page 16: 1 Server Scheduling in the L p norm Nikhil Bansal (CMU) Kirk Pruhs (Univ. of Pittsburgh)

16

Proof Idea

If job J of size x delayed for t units under SJFThen either,

1) Had lot of work of size < x before arrival of J2) Lot of work arriving continuously since J arrived.

In either case, Opt can be shown to have sufficiently many “old’’ unfinished jobs,

Page 17: 1 Server Scheduling in the L p norm Nikhil Bansal (CMU) Kirk Pruhs (Univ. of Pittsburgh)

17

Non-Clairvoyant Scheduling

Non-Clairvoyant Model [Motwani Phillips Torng ’94]

Scheduler does not know size of a jobLearns size only when job finishes.

Cannot do things like Shortest Job First, SRPT

What can we do?FCFS, Round Robin (time-sharing), …

Page 18: 1 Server Scheduling in the L p norm Nikhil Bansal (CMU) Kirk Pruhs (Univ. of Pittsburgh)

18

Measuring Performance

Resource Augmentation: s-speed, c-competitive

Online non-clairvoyant (s,I) Opt offline clairvoyant (1,I) · cMax I

Page 19: 1 Server Scheduling in the L p norm Nikhil Bansal (CMU) Kirk Pruhs (Univ. of Pittsburgh)

19

The Algorithm (MLF)

Multi-Level Feedback (MLF): Used in Windows NT, Unix

Levels L0,L1,L2,… job enters L0 first

In Li, receive 2i amount of work,

then promoted to Li+1

Work on level i, iff no job in level 0 .. i-1

L0

L1

L2

Page 20: 1 Server Scheduling in the L p norm Nikhil Bansal (CMU) Kirk Pruhs (Univ. of Pittsburgh)

20

Previous Results (Non-Clairvoyant)L1 norm of Flow Time:

MLF: 1+ speed, O(1/) competitive [Kalyanasundaram, Pruhs

’95]

L1 norm of Stretch:

MLF: 1+ speed, O(1/4 log2 B) competitive [B.,

Dhamdhere, Konemann, Sinha’ 03]Any algorithm is 1+ speed (log B/) competitive

B = ratio of maximum to minimum job size

Page 21: 1 Server Scheduling in the L p norm Nikhil Bansal (CMU) Kirk Pruhs (Univ. of Pittsburgh)

21

Our Results

MLF is 1+ speed , O(1/4) competitivefor all norms of flow time

MLF is 1+ speed, O(1/4 log2 B) competitivefor all norms of stretch

Page 22: 1 Server Scheduling in the L p norm Nikhil Bansal (CMU) Kirk Pruhs (Univ. of Pittsburgh)

22

Analysis

Generic technique: reduce MLF to SJF (Shortest Job First) Reduces a non-clairvoyant problem into a clairvoyant one.

Page 23: 1 Server Scheduling in the L p norm Nikhil Bansal (CMU) Kirk Pruhs (Univ. of Pittsburgh)

23

Final Result

Round Robin: At any time, share processor equally

Considered to be fair (each job treated equally) But not good according to the Lp norm criteria

Round Robin is not 1+ speed no(1) competitive(for sufficiently small )

Page 24: 1 Server Scheduling in the L p norm Nikhil Bansal (CMU) Kirk Pruhs (Univ. of Pittsburgh)

24

Open Problems

1) Offline case totally open NP-Hard? Non-trivial approximation algorithms?

2) Multiple machines

3) Other notions to deal with tradeoff between average vs. max performance

Page 25: 1 Server Scheduling in the L p norm Nikhil Bansal (CMU) Kirk Pruhs (Univ. of Pittsburgh)

25

Thank You!

Page 26: 1 Server Scheduling in the L p norm Nikhil Bansal (CMU) Kirk Pruhs (Univ. of Pittsburgh)

26

An example

Goal: Minimize fi2 (i.e. p=2)

a job of size 1 arrives for n time units

If n small ( < L2), work on the small jobsIf n big ( > L2), at time L2, shift to finish the big job

………

Good algorithm: A combination of SRPT + FCFS

Size L

Page 27: 1 Server Scheduling in the L p norm Nikhil Bansal (CMU) Kirk Pruhs (Univ. of Pittsburgh)

27

MLF

1

3

7

15

Page 28: 1 Server Scheduling in the L p norm Nikhil Bansal (CMU) Kirk Pruhs (Univ. of Pittsburgh)

28

MLF

1

3

7

15

Page 29: 1 Server Scheduling in the L p norm Nikhil Bansal (CMU) Kirk Pruhs (Univ. of Pittsburgh)

29

MLF

1

3

7

15

Page 30: 1 Server Scheduling in the L p norm Nikhil Bansal (CMU) Kirk Pruhs (Univ. of Pittsburgh)

30

MLF

1

3

7

15

1

3

7

Page 31: 1 Server Scheduling in the L p norm Nikhil Bansal (CMU) Kirk Pruhs (Univ. of Pittsburgh)

31

MLF

1

3

7

15

1

3

7

Page 32: 1 Server Scheduling in the L p norm Nikhil Bansal (CMU) Kirk Pruhs (Univ. of Pittsburgh)

32

MLF

1

3

7

15

1

3

7

Page 33: 1 Server Scheduling in the L p norm Nikhil Bansal (CMU) Kirk Pruhs (Univ. of Pittsburgh)

33

MLF

1

3

7

15

1

3

7

Page 34: 1 Server Scheduling in the L p norm Nikhil Bansal (CMU) Kirk Pruhs (Univ. of Pittsburgh)

34

MLF

1

3

7

15

1

3

7

Page 35: 1 Server Scheduling in the L p norm Nikhil Bansal (CMU) Kirk Pruhs (Univ. of Pittsburgh)

35

Connection between MLF and SJF

1

3

7

15

1 2 4 8

Instance J : 2i-1Instance J’ : 1,2,4,…,2i-1

J J’

Page 36: 1 Server Scheduling in the L p norm Nikhil Bansal (CMU) Kirk Pruhs (Univ. of Pittsburgh)

36

MLF and SJF

1

3

7

15

1 2 4 8

Instance J : 2i-1Instance J’ : 1,2,4,…,2i-1

Page 37: 1 Server Scheduling in the L p norm Nikhil Bansal (CMU) Kirk Pruhs (Univ. of Pittsburgh)

37

MLF and SJF

1

3

7

15

1 2 4 8

Instance J : 2i-1Instance J’ : 1,2,4,…,2i-1

Page 38: 1 Server Scheduling in the L p norm Nikhil Bansal (CMU) Kirk Pruhs (Univ. of Pittsburgh)

38

MLF and SJF

1

3

7

15

1 2 4 8

1

3

7

1 2 4

Instance J : 2i-1Instance J’ : 1,2,4,…,2i-1

Page 39: 1 Server Scheduling in the L p norm Nikhil Bansal (CMU) Kirk Pruhs (Univ. of Pittsburgh)

39

MLF and SJF

1

3

7

15

1 2 4 8

1

3

7

1 2 4

MLF works on a job in level i SJF works on 2i size copy of same job

MLF works on smallest levelSJF works on smallest job

Page 40: 1 Server Scheduling in the L p norm Nikhil Bansal (CMU) Kirk Pruhs (Univ. of Pittsburgh)

40

MLF and SJF

1

3

7

15

1 2 4 8

1

3

7

1 2 4

MLF works on a job in level i SJF works on 2i size copy of same job

MLF works on smallest levelSJF works on smallest job

Page 41: 1 Server Scheduling in the L p norm Nikhil Bansal (CMU) Kirk Pruhs (Univ. of Pittsburgh)

41

Analysis Idea

2 Main ideas:1) MLF(J) can be viewed as SJF (J’)

2) We know that SJF(J’) ¼ Opt(J’), so MLF(J) ¼ Opt(J’)

Opt(J)

previous clairvoyant result

Fairly general technique, usually allows us to reduce a non-clairvoyant problem into a clairvoyant one.