online scheduling of precedence constrained tasks yumei huo yh23 [email protected] department of...

42
Online Scheduling of Precedence Constrained Tasks Yumei Huo http://web.njit.edu/~yh23 [email protected] Department of Computer Science New Jersey Institute of T echnology

Post on 22-Dec-2015

223 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: Online Scheduling of Precedence Constrained Tasks Yumei Huo yh23 yh23@njit.edu Department of Computer Science New Jersey Institute

Online Scheduling of Precedence Constrained Tasks

Yumei Huohttp://web.njit.edu/~yh23

[email protected]

Department of Computer Science

New Jersey Institute of Technology

Page 2: Online Scheduling of Precedence Constrained Tasks Yumei Huo yh23 yh23@njit.edu Department of Computer Science New Jersey Institute

2

Outline

• Introduction: – Three basic scheduling algorithms

• Online Scheduling of Precedence Constrained Tasks– Four nonpreemptive scheduling problems– Three preemptive scheduling problems

• Future Work

Page 3: Online Scheduling of Precedence Constrained Tasks Yumei Huo yh23 yh23@njit.edu Department of Computer Science New Jersey Institute

3

Outline

• Introduction: – Three basic scheduling algorithms

• Online Scheduling of Precedence Constrained Tasks– Four nonpreemptive scheduling problems– Three preemptive scheduling problems

• Future Work

Page 4: Online Scheduling of Precedence Constrained Tasks Yumei Huo yh23 yh23@njit.edu Department of Computer Science New Jersey Institute

4

Coffman-Graham algorithm(P2|pj=1, prec|Cmax and P2|pj=1, prec| Ci )

Step 1. Labeling

Step 2. Scheduling

Page 5: Online Scheduling of Precedence Constrained Tasks Yumei Huo yh23 yh23@njit.edu Department of Computer Science New Jersey Institute

5

Coffman-Graham algorithm (cont.)

• Comparing two decreasing sequences of positive integers: by lexicographical order

• Example:

(8, 6, 4, 3) < (8, 6, 5) and (9, 8, 6) < (9, 8, 6, 4, 3).

Page 6: Online Scheduling of Precedence Constrained Tasks Yumei Huo yh23 yh23@njit.edu Department of Computer Science New Jersey Institute

6

Example of Coffman-Graham algorithm

1 2

3

4 5

76

8 9

(9) (8)

(7)

(6)(5)

(4)(3)

(1) (2)

8462

9753176543210

(1) (2,1)

Page 7: Online Scheduling of Precedence Constrained Tasks Yumei Huo yh23 yh23@njit.edu Department of Computer Science New Jersey Institute

7

Hu’s algorithm(P|pj=1, intree|Cmax and P|pj=1, outtree|Cmax )

Step 1. Labeling

Step 2. Scheduling

Page 8: Online Scheduling of Precedence Constrained Tasks Yumei Huo yh23 yh23@njit.edu Department of Computer Science New Jersey Institute

8

Hu’s algorithm---Level

• Definition: The level of a job i with no immediate successor is its processing time pi. The level of a job with immediate successor(s) is its processing time plus the maximum level of its immediate successor(s).

Page 9: Online Scheduling of Precedence Constrained Tasks Yumei Huo yh23 yh23@njit.edu Department of Computer Science New Jersey Institute

9

Example for Hu’s algorithm

(1)(2)(3)(5)

(6)

(4)

(7)

(1)(2)(3)(5)

(6)

(4)

(7)

(1)(2)(3)(5)

(6)

(4)

(7)

(8)(9)(10)

(11)

(1)(2)(3)(5)

(6)

(4)

(7)

(8)(9)(10)

(11)(12)(13)

(1)(2)(3)(5)

(6)

(4)

(7)

(8)(9)(10)

(11)(12)(13)

(14)(15)

(8)(9)(10)

(11)(12)(13)

(14)(15)

(16)

Page 10: Online Scheduling of Precedence Constrained Tasks Yumei Huo yh23 yh23@njit.edu Department of Computer Science New Jersey Institute

10

Muntz-Coffman algorithm (P2|pmtn, prec |Cmax, P|pmtn, intree|Cmax and P|pmtn, outtree|Cmax )

Assign one processor each to the jobs at the highest level. If there is a tie among y jobs (because they are at the same level) for the last x (x < y) processors, then assign x/y processor to each of these y jobs. Whenever either of the two events below occurs, reassign the processors to the unexecuted portion of the unfinished tasks according to the above rule.

Event 1: A task is completed.

Event 2: We reach a point where, if we were to continue the present assignment, we would be executing some tasks at a lower level at a faster rate than other tasks at a higher level.

Page 11: Online Scheduling of Precedence Constrained Tasks Yumei Huo yh23 yh23@njit.edu Department of Computer Science New Jersey Institute

11

Example for Muntz-Coffman algorithm

Preemptive schedule

Processor-sharing schedule

Page 12: Online Scheduling of Precedence Constrained Tasks Yumei Huo yh23 yh23@njit.edu Department of Computer Science New Jersey Institute

12

Outline

• Introduction: – Three basic scheduling algorithms

• Online Scheduling of Precedence Constrained Tasks– Four nonpreemptive scheduling problems– Three preemptive scheduling problems

• Future Work

Page 13: Online Scheduling of Precedence Constrained Tasks Yumei Huo yh23 yh23@njit.edu Department of Computer Science New Jersey Institute

13

Online Scheduling

• Tasks are released, along with their constraints, at various different times.The scheduler schedules tasks with no future information.

• We say that an online scheduling algorithm is optimal if it always produces a schedule with the minimum Cmax, i.e., a schedule as good as any schedule produced by any scheduling algorithm with full knowledge of future releases of tasks.

Page 14: Online Scheduling of Precedence Constrained Tasks Yumei Huo yh23 yh23@njit.edu Department of Computer Science New Jersey Institute

14

Classical Scheduling Problems with polynomial optimal algorithms

• P|pj=1, intree|Cmax and P|pj=1, outtree|Cmax --- Hu’s a

lgorithm

• P2|pj=1, prec|Cmax and P2|pj=1, prec| Ci --- Coffman-

Graham algorithm

• P2|pmtn, prec |Cmax, P|pmtn, intree|Cmax and P|pmtn, outtree|Cmax --- Muntz-Coffman algorithm

• P|pmtn|Cmax --- McNaughton’s Rule

Page 15: Online Scheduling of Precedence Constrained Tasks Yumei Huo yh23 yh23@njit.edu Department of Computer Science New Jersey Institute

15

Online version of these problems• Nonpreemptive scheduling problems:

– P2|pj=p, chainsi are released at ri|Cmax

– P|pj=1, intreei is released at ri|Cmax

– P|pj=1, outtreei is released at ri|Cmax

– P2|pj=1, preci is released at ri|Cmax

• Preemptive scheduling problems:

– P2|pmtn, preci is released at ri|Cmax

– P|pmtn, intreei is released at ri|Cmax

– P|pmtn, outtreei is released at ri|Cmax

– P|pmtn, rj|Cmax (K.S.Hong and J.Y-T.Leung, 1988)

Page 16: Online Scheduling of Precedence Constrained Tasks Yumei Huo yh23 yh23@njit.edu Department of Computer Science New Jersey Institute

16

Our results• Nonpreemptive scheduling problems:

– P2|pj=p, chainsi are released at ri|Cmax-----no optimal algorithm can po

ssibly exist

– P|pj=1, intreei is released at ri|Cmax-----no optimal algorithm can possi

bly exist

– P2|pj=1, preci is released at ri|Cmax ---- there is optimal algorithm

– P|pj=1, outtreei is released at ri|Cmax----- there is optimal algorithm

• Preemptive scheduling problems:

– P|pmtn, intreei is released at ri|Cmax---- no optimal algorithm can possi

bly exist

– P2| pmtn, preci is released at ri|Cmax ---- there is optimal algorithm

– P|pmtn, outtreei is released at ri|Cmax---- there is optimal algorithm

Page 17: Online Scheduling of Precedence Constrained Tasks Yumei Huo yh23 yh23@njit.edu Department of Computer Science New Jersey Institute

17

Our results• Nonpreemptive scheduling problems:

– P2|pj=p, chainsi are released at ri|Cmax-----no optimal algorithm can po

ssibly exist

– P|pj=1, intreei is released at ri|Cmax-----no optimal algorithm can possi

bly exist

– P2|pj=1, preci is released at ri|Cmax ---- there is optimal algorithm

– P|pj=1, outtreei is released at ri|Cmax----- there is optimal algorithm

• Preemptive scheduling problems:

– P|pmtn, intreei is released at ri|Cmax---- no optimal algorithm can possi

bly exist

– P2| pmtn, preci is released at ri|Cmax ---- there is optimal algorithm

– P|pmtn, outtreei is released at ri|Cmax---- there is optimal algorithm

Page 18: Online Scheduling of Precedence Constrained Tasks Yumei Huo yh23 yh23@njit.edu Department of Computer Science New Jersey Institute

18

P2|pj=p, chainsi are released at ri|Cmax (Counte

rexample)

M=2pj=2

654

1110987321

2 4 6 8 10 12 14 16 18 20 22 240

S1

S26 21 23 250 195

S254

21

63

1110987

2 4 7 9 11 13 15 176 21 23 250 195

654

321

2 4 6 8 10 12 14 16 18 20 22 240

S1

4

5

6

1

2

3

4

5

6

4

5

6

1

2

3

1

2

3

Chains released at r1=0 Chains released at r2=5

7

8

9

10

11

7

8

9

10

11

Page 19: Online Scheduling of Precedence Constrained Tasks Yumei Huo yh23 yh23@njit.edu Department of Computer Science New Jersey Institute

19

Our results• Nonpreemptive scheduling problems:

– P2|pj=p, chainsi are released at ri|Cmax-----no optimal algorithm can po

ssibly exist

– P|pj=1, intreei is released at ri|Cmax-----no optimal algorithm can possi

bly exist

– P2|pj=1, preci is released at ri|Cmax ---- there is optimal algorithm

– P|pj=1, outtreei is released at ri|Cmax----- there is optimal algorithm

• Preemptive scheduling problems:

– P|pmtn, intreei is released at ri|Cmax---- no optimal algorithm can possi

bly exist

– P2| pmtn, preci is released at ri|Cmax ---- there is optimal algorithm

– P|pmtn, outtreei is released at ri|Cmax---- there is optimal algorithm

Page 20: Online Scheduling of Precedence Constrained Tasks Yumei Huo yh23 yh23@njit.edu Department of Computer Science New Jersey Institute

20

P|pj=1, intreei is released at ri|Cmax

(Counterexample)4 5 6

7 8 910 11 12

14 1316 1518 1720 1922 21

23

Tree1 released at r1=0

M=3 24

25

26 27

28 29

30 31

32

Tree2 released at r2=4

S11296

22201816141185

2321191715131074

1 2 3 4 5 6 7 8 9 10 11 120

22192017151296

323129271816141185

23213028262524131074

1 2 3 4 5 6 7 8 9 10 11 120

312129192712171513

32302826162411975

23222018251410864

1 2 3 4 5 6 7 8 9 10 11 120

S2

Page 21: Online Scheduling of Precedence Constrained Tasks Yumei Huo yh23 yh23@njit.edu Department of Computer Science New Jersey Institute

21

Our results• Nonpreemptive scheduling problems:

– P2|pj=p, chainsi are released at ri|Cmax-----no optimal algorithm can po

ssibly exist

– P|pj=1, intreei is released at ri|Cmax-----no optimal algorithm can possi

bly exist

– P2|pj=1, preci is released at ri|Cmax ---- there is optimal algorithm

– P|pj=1, outtreei is released at ri|Cmax----- there is optimal algorithm

• Preemptive scheduling problems:

– P|pmtn, intreei is released at ri|Cmax---- no optimal algorithm can possi

bly exist

– P2| pmtn, preci is released at ri|Cmax ---- there is optimal algorithm

– P|pmtn, outtreei is released at ri|Cmax---- there is optimal algorithm

Page 22: Online Scheduling of Precedence Constrained Tasks Yumei Huo yh23 yh23@njit.edu Department of Computer Science New Jersey Institute

22

P2|pj=1, preci is released at ri|Cmax

• Algorithm A:

Whenever new tasks arrive, do {

t =the current time;

U= the set of tasks active (i.e., not finished) at time t;

Call the Coffman-Graham algorithm to reschedule the tasks in U;

}

Page 23: Online Scheduling of Precedence Constrained Tasks Yumei Huo yh23 yh23@njit.edu Department of Computer Science New Jersey Institute

23

Example

1 2

3

4 5

76

8 9

(9) (8)

(7)

(6)(5)

(4)(3)

(1) (2)

8462

9753176543210

(9)(8)

(5)

(1) (2)

Tasks not finished at t=2

(3) (4)

(6) (7)

(10)

10 (11)

Tasks released at t=2

11

12 13

14 15

4

7

5

8 9

62

3110 2 9

9151245

814713111086543 7

Page 24: Online Scheduling of Precedence Constrained Tasks Yumei Huo yh23 yh23@njit.edu Department of Computer Science New Jersey Institute

24

Our result

Theorem 2.1.4 Algorithm A is optimal for P2|pj=1, preci is released at ri|Cmax.

Moreover, the schedule produced by Algorithm A has the largest number of tasks completed at any time instant t.

(Note: Algorithm A is optimal for P2|pj=1, preci is re

leased at ri| Cj)

Page 25: Online Scheduling of Precedence Constrained Tasks Yumei Huo yh23 yh23@njit.edu Department of Computer Science New Jersey Institute

25

Our results• Nonpreemptive scheduling problems:

– P2|pj=p, chainsi are released at ri|Cmax-----no optimal algorithm can po

ssibly exist

– P|pj=1, intreei is released at ri|Cmax-----no optimal algorithm can possi

bly exist

– P2|pj=1, preci is released at ri|Cmax ---- there is optimal algorithm

– P|pj=1, outtreei is released at ri|Cmax----- there is optimal algorithm

• Preemptive scheduling problems:

– P|pmtn, intreei is released at ri|Cmax---- no optimal algorithm can possi

bly exist

– P2| pmtn, preci is released at ri|Cmax ---- there is optimal algorithm

– P|pmtn, outtreei is released at ri|Cmax---- there is optimal algorithm

Page 26: Online Scheduling of Precedence Constrained Tasks Yumei Huo yh23 yh23@njit.edu Department of Computer Science New Jersey Institute

26

P|pj=1, outtreei is released at ri|Cmax

• Algorithm B:

Whenever new tasks arrive, do {

t =the current time;

U= the set of tasks active (i.e., not finished) at time t;

Call Hu's algorithm to reschedule the tasks in U;

}

Page 27: Online Scheduling of Precedence Constrained Tasks Yumei Huo yh23 yh23@njit.edu Department of Computer Science New Jersey Institute

27

Example

Page 28: Online Scheduling of Precedence Constrained Tasks Yumei Huo yh23 yh23@njit.edu Department of Computer Science New Jersey Institute

28

Example

Page 29: Online Scheduling of Precedence Constrained Tasks Yumei Huo yh23 yh23@njit.edu Department of Computer Science New Jersey Institute

29

Our result

Theorem 2.1.5 Algorithm B is optimal for P|pj

=1, outtreei is released at ri|Cmax.Moreover, the schedule produced by Algorithm B has the largest number of tasks completed at any time instant t.

(Note: Algorithm B is optimal for P|pj=1, outtreei is released at ri| Cj)

Page 30: Online Scheduling of Precedence Constrained Tasks Yumei Huo yh23 yh23@njit.edu Department of Computer Science New Jersey Institute

30

Our results• Nonpreemptive scheduling problems:

– P2|pj=p, chainsi are released at ri|Cmax-----no optimal algorithm can po

ssibly exist

– P|pj=1, intreei is released at ri|Cmax-----no optimal algorithm can possi

bly exist

– P2|pj=1, preci is released at ri|Cmax ---- there is optimal algorithm

– P|pj=1, outtreei is released at ri|Cmax----- there is optimal algorithm

• Preemptive scheduling problems:

– P|pmtn, intreei is released at ri|Cmax---- no optimal algorithm can possi

bly exist

– P2| pmtn, preci is released at ri|Cmax ---- there is optimal algorithm

– P|pmtn, outtreei is released at ri|Cmax---- there is optimal algorithm

Page 31: Online Scheduling of Precedence Constrained Tasks Yumei Huo yh23 yh23@njit.edu Department of Computer Science New Jersey Institute

31

P|pj=1, pmtn, intreei is released at ri|Cmax

(Counterexample)4 5 6

7 8 910 11 12

14 1316 1518 1720 1922 21

23

Tree1 released at r1=0

M=3 24

25

26 27

28 29

30 31

32

Tree2 released at r2=4

S11296

22201816141185

2321191715131074

1 2 3 4 5 6 7 8 9 10 11 120

12171513

211911975

23222018161410864

1 2 3 4 5 6 7 8 9 10 11 120

S2

22192017151296

323129271816141185

23213028262524131074

1 2 3 4 5 6 7 8 9 10 11 120

312129192712171513

32302826162411975

23222018251410864

1 2 3 4 5 6 7 8 9 10 11 120

Page 32: Online Scheduling of Precedence Constrained Tasks Yumei Huo yh23 yh23@njit.edu Department of Computer Science New Jersey Institute

32

Our results• Nonpreemptive scheduling problems:

– P2|pj=p, chainsi are released at ri|Cmax-----no optimal algorithm can po

ssibly exist

– P|pj=1, intreei is released at ri|Cmax-----no optimal algorithm can possi

bly exist

– P2|pj=1, preci is released at ri|Cmax ---- there is optimal algorithm

– P|pj=1, outtreei is released at ri|Cmax----- there is optimal algorithm

• Preemptive scheduling problems:

– P|pmtn, pj=1, intreei is released at ri|Cmax---- no optimal algorithm can

possibly exist

– P2| pmtn, preci is released at ri|Cmax ---- there is optimal algorithm

– P|pmtn, outtreei is released at ri|Cmax---- there is optimal algorithm

Page 33: Online Scheduling of Precedence Constrained Tasks Yumei Huo yh23 yh23@njit.edu Department of Computer Science New Jersey Institute

33

P2| pmtn,preci is released at ri|Cmax

• Algorithm C:

Whenever new tasks arrive, do {

t =the current time;

U= the set of tasks active (i.e., not finished) at time t;

Call Muntz-Coffman algorithm to reschedule the tasks in U;

}

Page 34: Online Scheduling of Precedence Constrained Tasks Yumei Huo yh23 yh23@njit.edu Department of Computer Science New Jersey Institute

34

Example

Page 35: Online Scheduling of Precedence Constrained Tasks Yumei Huo yh23 yh23@njit.edu Department of Computer Science New Jersey Institute

35

Example

Page 36: Online Scheduling of Precedence Constrained Tasks Yumei Huo yh23 yh23@njit.edu Department of Computer Science New Jersey Institute

36

Our result

Theorem 2.2.4 Algorithm C is an optimal online algorithm for P2| pmtn,preci is releas

ed at ri|Cmax.

Page 37: Online Scheduling of Precedence Constrained Tasks Yumei Huo yh23 yh23@njit.edu Department of Computer Science New Jersey Institute

37

Our results• Nonpreemptive scheduling problems:

– P2|pj=p, chainsi are released at ri|Cmax-----no optimal algorithm can po

ssibly exist

– P|pj=1, intreei is released at ri|Cmax-----no optimal algorithm can possi

bly exist

– P2|pj=1, preci is released at ri|Cmax ---- there is optimal algorithm

– P|pj=1, outtreei is released at ri|Cmax----- there is optimal algorithm

• Preemptive scheduling problems:

– P|pmtn, intreei is released at ri|Cmax---- no optimal algorithm can possi

bly exist

– P2| pmtn, preci is released at ri|Cmax ---- there is optimal algorithm

– P|pmtn, outtreei is released at ri|Cmax---- there is optimal algorithm

Page 38: Online Scheduling of Precedence Constrained Tasks Yumei Huo yh23 yh23@njit.edu Department of Computer Science New Jersey Institute

38

P|pmtn, outtreei is released at ri|Cmax

Theorem 2.2.6 Algorithm C is an optimal online algorithm for P|pmtn, outtreei is relea

sed at ri|Cmax.

Page 39: Online Scheduling of Precedence Constrained Tasks Yumei Huo yh23 yh23@njit.edu Department of Computer Science New Jersey Institute

39

Outline• Introduction:

– Three basic scheduling algorithms

• Online Scheduling of Precedence Constrained Tasks– Four nonpreemptive scheduling problems– Three preemptive scheduling problems

• Future Work

Page 40: Online Scheduling of Precedence Constrained Tasks Yumei Huo yh23 yh23@njit.edu Department of Computer Science New Jersey Institute

40

Future Work (Continued Work)

• Online scheduling problems– Competitive Ratio– Objective function: mean flow time

Page 41: Online Scheduling of Precedence Constrained Tasks Yumei Huo yh23 yh23@njit.edu Department of Computer Science New Jersey Institute

41

Thank you!

Page 42: Online Scheduling of Precedence Constrained Tasks Yumei Huo yh23 yh23@njit.edu Department of Computer Science New Jersey Institute

42

Application of Online Scheduling

• Industrial Applications• Multiuser operating systems such as Unix and

Windows• Web servers• Database servers• Load balancers sitting in front of server farms

(Pruhs K., Sgall J., and Torng E., 2004 )