Optimal preemptive semi-online scheduling on two uniform processors

4 downloads 1053 Views 216KB Size Report
be scheduled without the knowledge of future jobs in the sequence and such ... prior information (number of jobs and sizes of jobs) on all the jobs, can be ...
Optimal preemptive semi-online scheduling on two uniform processors Donglei Du∗ Faculty of Administration, University of New Brunswick, P.O. Box 4400, Fredericton, NB, E3B 5V4, Canada

Abstract We investigate a preemptive semi-online scheduling problem. Jobs with sizes within a certain range [1, r] (r ≥ 1) arrive one by one to be scheduled on two uniform parallel processors with speed 1 and s ≥ 1, respectively. The objective is to minimize makespan. We characterize the optimal competitive ratio as a function of both s and r by devising a deterministic on-line scheduling algorithm along with a matching lower bound, which also holds for randomized algorithms.

Keywords: On-line algorithm; Uniform processor, Scheduling; Preemption

1 Introduction The semi-online scheduling problem we are interested in can be formally stated as follows: There are two uniform parallel processors M1 (slow processor) and M2 (fast processor) with speeds of 1 and s ≥ 1, respectively. A set of jobs J = {J1 , . . . , Jn } with sizes x1 , · · · , xn (1 ≤ xi ≤ r, i = 1, · · · , n) arrive one by one in a sequence. A job with any specied size

x takes x and x/s units of time to complete on M1 and M2 , respectively. Each job has to be scheduled without the knowledge of future jobs in the sequence and such scheduling is irrevocable. Whenever a job comes, it is allocated with one or several non-overlapping time slots with preemption being allowed, to possibly dierent processors. Such an allocation is called a (feasible) schedule. The objective is to nd a schedule which minimizes the ∗

e-mail: [email protected]. Research supported in part by NSERC grant 283103

1

makespan (the maximum completion time). The o-line version of problem, where we have prior information (number of jobs and sizes of jobs) on all the jobs, can be denoted as

Q2|pmtn, 1 ≤ xi ≤ r|Cmax using the three-eld notation as in [9]. Note that the result in this paper can be extended to deal with any job size within

[x, rx] (for any size x > 0) by normalization. Similarly, we can deal with any combination of processor speeds s1 and s2 by normalizing them to 1, s (s ≥ 1), respectively. This kind of problem, termed as semi-online scheduling in the literature, arises when partial information on jobs is available in advance. This is contrary to the ordinary on-line scheduling for which no information is known in advance at all. In our problem, all the job sizes are known to be within a certain interval. Some other possible scenarios are: (1) jobs may arrive in a prespecied order ([3], [4], [10] and [11]); (2) the total job size may be known in advance ([1] and [8]); and (3) the maximum job size may be known in advance ([7]). The reader is referred to the aforementioned papers and the references there for furthermore information regarding to even more variants on semi-online scheduling. The quality of a semi-online scheduling algorithm will be measured by its competitive

ratio, which is dened to be the worst-case ratio between the makespan of the semi-online algorithm and the optimal o-line makespan over all instances. Several results exist for two identical parallel processors. He and Zhang ([7]) study the nonpreemptive semi-online problem whose o-line version is P 2|1 ≤ xi ≤ r|Cmax . They give an algorithm with an optimal competitive ratio as a function of r. Du ([2]) also investigates the same problem, and propose a randomized algorithm. The preemptive semi-online problem whose o-line version is P 2|pmtn, 1 ≤ xi ≤ r|Cmax , is solved by Du ([2]), who presents an algorithm with an optimal competitive ratio also as a function of r. The (ordinary) on-line preemptive scheduling problem on two uniform parallel processors without any restriction on the job sizes, whose o-line version is Q2|pmtn|Cmax , is solved by Wen and Du ([12]), and independently by Epstein et al. ([5]). They devise best possible deterministic algorithms with a competitive ratio of (1 + s)2 /(1 + s + s2 ), which is shown to best possible even for randomized algorithms by using the job sequence with sizes of

1, s, s + s2 . This implies that their algorithms are also best possible for our semi-online scheduling problem when r ≥ s + s2 . However, our result (Theorem 2.1) shows that this 2

ratio should be best possible for any r ≥ 2s. This means the lower bound proof in both papers are not sucient for our purpose (except the special case s = 1), and we will give a new lower bound proof for r ≥ 2s in Theorem 2.1 along with other cases. We characterize the best competitive ratio as a function of both s and r in the next section, and conclude the paper by oering some open questions in Section 3.

2 Main result and analysis Theorem 2.1 (1) There exists a deterministic semi-online algorithm for the problem with competitive         α=       

ratio α, where

α1 = α2 = α3 =

s(1+s)(1+r) , 1+s+s2 (1+r) s(1+s) , 1+s2 (1+s)(2+r) , 2(1+s)+sr

α4 =

(1+s)2 , 1+s+s2

2 if (s, r) ∈ Ω1 = { s−1 ≤ r < s}; if (s, r) ∈ Ω2 = {s ≤ r < 2(s − 1)}; if (s, r) ∈ Ω3 = {r ≥ 2(s − 1), s > 2} ∪ {r < ∪{r < 2s, 1 ≤ s ≤ 2}; if (s, r) ∈ Ω4 = {r ≥ 2s},

2 ,s s−1

> 2}

and α1 ≤ α2 ≤ α3 ≤ α4 when they are dened in their respective regions (see Figure 1 for an illustration). (2) Moreover, no randomized semi-online algorithm can achieve a competitive ratio smaller than α.

r

r

2s

r 2(s 1)

:4

r

s

:2

:1

2

:3 r

1

2

2 s 1

3

s

Figure 1: Four regions Ω1 , Ω2 , Ω3 , and Ω4

3

Proof:

It is easy to check α1 ≤ α2 ≤ α3 ≤ α4 when they are dened in their respective

regions. (1) We rst devise a semi-online algorithm with the claimed ratio. As mentioned in the introduction, the upper bound α4 for (s, r) ∈ Ω4 is already implied by the results in [12] and [5]. Therefore, we only need to prove the upper bound for (s, r) ∈

Ω1 ∪ Ω2 ∪ Ω3 . For notational simplicity, we will identify a job with its length whenever there is no confusion. To achieve the best possible competitive ratio, we only need to consider those algorithms with no simultaneous idle times. We introduce some notations rst. In any semi-online algorithm, after scheduling some jobs, let Cmax and L, respectively, be the makespan and the total job size prior to the new incoming job x. The idle space Ii (i = 1, 2) on machine Mi is the total time by Cmax during which Mi is idle, i.e., the dierence between Cmax and the total processing time of the jobs assigned to Mi so far. Thus I = I1 + sI2 is the total idle space before Cmax . Moreover, these quantities satisfy L + I = (1 + s)Cmax (since there is no simultaneous idle time). Denote

COP T to be the optimal o-line makespan prior to x, which is equal to the maximum of two quantities: (a) the maximum job size divided by s, and (b) the total job size divided by 1 + s (see [6]). Any aforementioned quantity with a prime (0) attached denotes the corresponding quantity after x is scheduled. We will show the following algorithm H achieves the claimed ratio α.

Algorithm H : When a new job x arrives: Step 1. If possible, schedule x appropriately such that the resulting makespan 0 = (1 + s − sα) min{L0 , Cmax

L0 + r }. 1+s

Step 2. Otherwise, schedule x into the available idle space within the interval [0, Cmax ], and schedule the remaining part of x, if any, on the fast machine M2 from time Cmax on. So 0 = Cmax + max{0, Cmax

4

x−I }. s

(1)

In the above algorithm, we can check whether x can be scheduled in step 1 or not by examining a small inequalities system. Let δ1 and sδ2 be the job sizes that have been scheduled into the idle space I1 and sI2 before Cmax on M1 and M2 , respectively. Let δ3 and

sδ4 be the job sizes that have been scheduled after Cmax on M1 and M2 , respectively. Then 0 we have Cmax = Cmax + δ3 + δ4 , and L0 = L + x. Therefore x can be scheduled in step 1 if

and only if the following inequalities system (2)-(5) with the four δ -variables is feasible:

Cmax + δ3 + δ4 = (1 + s − sα) min{L + x,

L+x+r } 1+s

(2)

δ1 + sδ2 + δ3 + sδ4 = x

(3)

0 ≤ δ1 ≤ I1

(4)

0 ≤ δ2 ≤ I2

(5)

Before we prove that algorithm H is indeed α-competitive, we rst show by induction on the number of jobs that algorithm H satises the following condition (6)-(7) at any time:

Cmax ≥ (1 + s − sα) min{L, if Cmax > (1 + s − sα) min{L,

L+r }, 1+s

L+r } 1+s

(6)

then Cmax ≤ αCOP T

(7)

(6)-(7) is true when there is no job assigned. Suppose it is true before the processing of an arbitrary job x, we want to show it still holds after x is scheduled. (6)-(7) is satised obviously if x is scheduled in step 1. So suppose x is scheduled in step 2 for the rest of the argument. We rst prove by contradiction that (6) is satised after x. (a) Suppose (6) is not true after x, then the resulting makespan is less than (1 + s −

sα) min{L0 ,

L0 +r }. 1+s

(b) However, if x is scheduled exclusively on the slow machine M1 from time Cmax on, then the corresponding makespan Cmax + x ≥ (1 + s − sα) min{L0 ,

L0 +r } 1+s

by the inductive

hypothesis and the fact α ≥ 1. The above two facts (a) and (b) together imply that inequalities system (2)-(5) is feasible, which, however, means x must have been scheduled in step 1, a contradiction with the fact that x has been scheduled in step 2. 5

We now show that (7) continues to hold after x is assigned. Since x is scheduled in step 2, the new makespan after x is Cmax + max{0, (x − I)/s} according to (1). We only need to consider the case for x > I (otherwise (7) directly follows from the inductive hypothesis). So

0 Cmax = Cmax + (x − I)/s L + x − Cmax = s L + x − (1 + s − sα) min{L, L+r } 1+s ≤ s x α 1 + s − sα = max{(α − 1)L + , (L + x) + (x − r)} s 1+s s(1 + s) 0 ≤ αCOP T.

(8) (9) (10) (11) (12)

In the above, the second equality (9) follows from the relationship I = (1+s)Cmax −L, the rst inequality (10) follows from the inductive hypothesis Cmax ≥ (1 + s − sα) min{L, (L +

r)/(1 + s)}, and the second inequality (12) follows from the following argument: if x ≥ sL, then (α − 1)L + x/s ≤ αx/s, and if x < sL, then (α − 1)L + x/s < α(L + x)/(1 + s). 0 Thus (α − 1)L + x/s < α max{x/s, (L + x)/(1 + s)} ≤ αCOP T . Moreover, x ≤ r implies 0 α(L+x)/(1+s)+(1+s−sα)(x−r)/(s+s2 ) ≤ α(L+x)/(1+s) ≤ αCOP T , since 1+s−sα ≥ 0

by direct checking. We are now ready to show that algorithm H is indeed α-competitive based on condition (6)-(7). This is obvious for (7). So suppose Cmax = (1 + s − sα) min{L, (L + r)/(1 + s)}, and L ≥ 1 (otherwise L = 0 is trivial). We distinguish six mutually exclusive and exhaustive cases depending on which region (s, r) belongs to in the following.

Case 1. If (s, r) ∈ Ω1 ∩ {(s, r) : (rs − 1)L ≥ r(s + 1)}, then Cmax = (1 + s − sα) min{L, (L + r)/(1 + s)} ≤ (1 + s − sα1 )(L + r)/(1 + s) = (1 + s − sα1 )(1 + r/L)L/(1 + s) ≤ (1 + s − sα1 )(1 + (rs − 1)/(1 + s))L/(1 + s) = α1 L/(1 + s) ≤ α1 COP T , where the second inequality follows from the case assumption r/L ≤ (rs − 1)/(1 + s).

Case 2. If (s, r) ∈ Ω2 ∩ {(s, r) : (s − 1)L ≥ r}, then Cmax ≤ α2 COP T follows similarly by using the new case assumption r/L ≤ s − 1. 6

Case 3. If (s, r) ∈ Ω3 ∩ {(s, r) : L ≥ 2}, then Cmax ≤ α3 COP T follows similarly by using the new case assumption 1/L ≤ 1/2.

Case 4. If (s, r) ∈ Ω1 ∩ {(s, r) : (rs − 1)L < r(s + 1)}, then r(s + 1)/(rs − 1) is a decreasing function of r ∈ [2/(s − 1), s), which implies L < 2 by plugging in r = 2/(s − 1). This (together with our assumption L ≥ 1) means there is exactly one job assigned, so

COP T = L/s. Now we have Cmax ≤ (1 + s − sα1 )(L + r)/(1 + s) ≤ α1 L/s = α1 COP T , where the second inequality can be veried by comparing its two sides: [(1 + s −

sα1 )(L + r)/(1 + s)]/(α1 L/s) = [s(1 + s − sα1 )(1 + r/L)]/[(1 + s)α1 ] ≤ [s(1 + s − sα1 )(1 + r)]/[(1 + s)α1 ] = 1.

Case 5. If (s, r) ∈ Ω2 ∩ {(s, r) : (s − 1)L < r}, then r/(s − 1) is an increasing function of r ∈ [s, 2(s − 1)), which implies L < 2 by plugging in r = 2(s − 1). Similarly we have COP T = L/s. Therefore Cmax = (1 + s − sα2 )L ≤ α2 L/s = α2 COP T .

Case 6. If (s, r) ∈ Ω3 ∩ {(s, r) : L < 2}, then Cmax ≤ α3 COP T follows similarly as in Case 4 or 5, using the fact α3 ≥ max{α1 , α2 } when (s, r) ∈ Ω3 . Therefore in all cases, we prove that algorithm H is α-competitive. (2) We now prove the lower bound. Suppose on the contrary, there exists a randomized semi-online algorithm with competitive ratio less than α. Consider two sequences of jobs, one has the rst two jobs with sizes 1, r (r ≤ s), and the other has the rst three jobs with sizes 1, 1, r (r ≤ 2s). We only need to consider those algorithms with no simultaneous idle time. First consider the sequence 1, r (r ≤ s). After the rst job is scheduled, the optimal o-line makespan is 1/s. Let C be the current expected makespan, and E be the current expected total idle space on both processors, then we have 1 + E = (1 + s)C . So (1 + E)/(1 +

s) = C < α/s, which implies E ≤ (1 + s)α/s − 1. When the second job comes, the best we can do is to ll up all the existing idle periods and schedule the rest on the faster processor, so the new expected makespan is at least C + (r − E)/s = (1 + r + E)/(1 + s) + (r − E)/s >

(1 + r)/s − α/s2 . While the optimal o-line makespan is (1 + r)/(1 + s) (since r ≤ s), we

7

must have (1 + r)/(1 + s) − α/s2 < α(1 + r)/(1 + s) in order to guarantee the claimed ratio. However, this implies α > max{α1 , α2 }, where α2 follows by taking r = s. Next consider the sequence 1, 1, r (r ≤ 2s). After the rst two jobs are scheduled, the optimal o-line makespan is 2/(1 + s). Abusing the notations, let C be the current expected makespan, and E be the current expected total idle spaces on both processors. Then the current total job size 2 = (1 + s)C − E , implying C = (2 + E)/(1 + s), and

C ≤ 2α/(1 + s), from which we get E ≤ 2(α − 1). When the third job comes, the best we can do is to ll up all the existing idle periods and schedule the rest on the faster processor, so the new expected makespan is at least C + (r − E)/s = (2 + E)/(1 + s) + (r − E)/s >

(r + 2)/s − 2(1/s − 1/(1 + s))α. However, the optimal o-line makespan now is (2 + r)/(1 + s) (since r ≤ 2s). Thus (r + 2)/s − 2(1/s − 1/(1 + s))α < α(2 + r)/(1 + s), which implies

α > max{α3 , α4 }, where α4 follows by taking r = 2s. Together we have α > max{α1 , α2 , α3 , α4 }, case analysis with respect to the four dierent regions of Ωi (i = 1, · · · , 4) will lead to a contradiction. This nishes the lower bound proof.

2

3 Open questions Some obvious open questions remain: (1) note that the competitive ratios for Ω2 and Ω4 do not depend on r, a ner analysis may be needed to derive a r-related result; (2) design best possible deterministic and randomized semi-online algorithms for the corresponding nonpreemptive problem; and (3) generalize the result in this paper to more than two processors or other natural scheduling models.

Acknowledgement: The author is grateful to the valuable comments from the anonymous referee to improve the presentation of this paper.

References [1] E. Angelelli, M. G. Speranza, and Z. Tuza, Semi-online scheduling on two parallel processors with an upper bound on the items, Algorithmica 37, 2003, 243262.

8

[2] D. Du, On-Line scheduling similar jobs to minimize makespan on two identical processors,

Working Paper, Series 01, 2004, University of New Brunswick [3] L. Epstein, L.M. Favrholdt, Optimal preemptive semi-online scheduling to minimize makespan on two related machines, Operations Research Letters, 30(4), 2002, 269-275 [4] L. Epstein, L.M. Favrholdt, Optimal non-preemptive semi-online scheduling on two related machines, Proc. of the 27th MFCS, 2002, 245256. [5] L. Epstein, J. Noga, S. Seiden, J. Sgall, and G. Woeginger, Randomized on-line scheduling on two uniform machines , Journal of Scheduling 4(2), 2001, 7192. [6] T. Gonzalez, and S. Sahni, Preemptive scheduling of uniform processor systems, J. of

Assoc. Comput. Mach. 25, 1978, 92101. [7] Y. He, and G. Zhang, Semi on-Line scheduling on two identical machines, Information

Processing Letters 62(3), 1999, 179187. [8] H. Kellerer, V. Kotov, V. Speranza, and M.R. Tuza, Semi on-line algorithms for the partition problems, Operations Research Letters 21, 1997, 235242. [9] E.L. Lawler, J.K. Lenstra, A.H.G. Rinnooy Kan, and D.B. Shmoys, Sequencing and scheduling: Algorithms and complexity, Logistics of Production and Inventory (S.C. Graves, A.H.G. Rinnooy Kan and P.H. Zipkin, eds.), North-Holland, 1993. 445522. [10] S. Seiden, J. Sgall, and G.J. Woeginger, Semi-online scheduling with decreasing job sizes, Operations Research Letters 27(5), 2000, 215221. [11] W.P. Liu, J.B. Sidney, and A.V. Vliet, Ordinal algorithms for parallel machine scheduling, Operations Research Letters 18, 1996, 223232. [12] W. Wen, and D. Du, An optimal algorithm for preemptive on-line scheduling on two unifrom processors, Operations Research Letters 23, 1998, 113116.

9