resource constrained scheduling on multiple machines
TRANSCRIPT
l
jobs
alancingroblem isum of
Information Processing Letters 91 (2004) 177–182
www.elsevier.com/locate/ip
Resource constrained scheduling on multiple machines
Jan Remy
Eidgenössische Technische Hochschule Zürich, Institut für Theoretische Informatik,Haldeneggsteig 4, IFW E49.1, CH-8092 Zürich, Switzerland
Received 2 February 2004; received in revised form 15 April 2004
Communicated by S. Albers
Abstract
This paper is devoted to RESOURCECONSTRAINED SCHEDULING. An instance for this problem is given by a set ofn jobswith lengths and weights and a set ofm machines with capacities. At every time each machine can run arbitrary manyin parallel but the total weight of these jobs must not exceed the capacity of the machine. Furthermore them machines workin parallel and we wish to find a schedule that minimizes the makespan or the sum of completion times. Thus load bon a cluster of servers is a typical application for scheduling under resource constraints. For both measures the pNP-complete even form = 1. We show that the problem is approximable within factors of 2 (makespan) and 14.85 (scompletion times) for arbitrarym. 2004 Elsevier B.V. All rights reserved.
Keywords: Algorithms; Approximation algorithms; Scheduling
1. Introduction maxxi∈J ω(xi) � minpi∈P C(pi). Thus a solution is a
em
t
htsti.e.,
schedule for allm processors such that these resourceinga
g
erved
In this paper we consider a scheduling problknown as RESOURCECONSTRAINED SCHEDULING.Given is a setJ = {x1, . . . , xn} of jobs and a seP = {p1, . . . , pm} of machines. To each jobxi ∈ J weassign a lengthτ (xi) ∈ Z
+ and a weightω(xi) ∈ Z+.
In addition thearea of a job x ∈ J is defined bya(x) = ω(x)τ(x). Also we add a capacityC(pi) ∈ Z
+to each machinepi ∈ P and allowpi to run morethan one job in parallel unless the sum of the weigof the running jobs exceedsC(pi). We assume thaeach job can be processed on every machine,
E-mail address: [email protected] (J. Remy).
0020-0190/$ – see front matter 2004 Elsevier B.V. All rights resdoi:10.1016/j.ipl.2004.04.009
constraints are satisfied. More formal we are seeka functionf :J → P × N which assigns to each jobmachine and a starting time. Forxi ∈ J , let f1(xi) bethe machine to whichxi was assigned and letf2(xi)
denote the starting time ofxi . We assume that runninprocesses cannot be interrupted. If we write
Ri(t) = {x ∈ J : f1(x) = pi ∧
f2(x) � t < f2(x) + τ (x)}
for the set of jobs which are running on processorpi
at time t , the schedule must satisfy∑
x∈Ri(t)ω(x) �
C(pi) for all 1 � i � m and all t ∈ N. A solu-tion can be measured either by themakespan ζ :=maxx∈J (f2(x) + τ (x)) or by thesum of completion
.
178 J. Remy / Information Processing Letters 91 (2004) 177–182
times C := ∑x∈J (f2(x) + τ (x)). Even for m = 1
RESOURCE CONSTRAINED SCHEDULING is NP-in-
ess
e-
rlele-can
p-eythan
annghYuob-8erplein
[7].
hatthe
edof
or
Ifg oranereove
Fortunately the algorithm can be used form > 1, too.In this case, if a job terminates on machinepj , we scan
ve
isomeced
l
we
an
complete regardless which measure we wish to mimize [1].
Almost all modern computer systems can procjobs in parallel and thus RESOURCECONSTRAINED
SCHEDULING can be used to model real world scnarios like the following: A cluster ofm servers isavailable to process a set of jobs. For each servepi
there areC(pi) units of memory available. A scheduthat minimizes the makespan or the sum of comption times and prevents the servers from swappingbe determined by solving RESOURCECONSTRAINED
SCHEDULING.For m = 1 Garey and Graham introduced a 2-a
proximation algorithm for makespan [3]. In fact thaddressed a more general problem, where moreone resource constraint must be obeyed. Findingapproximation algorithm for the sum of completiotime remained an open problem until a breakthrouwas made by Schwiegelshohn, Turek, Wolf andwho found an algorithm that approximates the prlem within 32 [8]. They later improved the ratio to[4]. If there is no job, the weight of which is greatthan half the capacity of the machine then a simapproximation algorithm which schedules the jobsorder of increasing area yields a 2-approximationWe are not aware of any previous work form > 1 eventhough significant applications exist.
In Section 2 we show by a simple argument tthe algorithm of Garey and Graham approximatesmakespan for arbitrarym with ratio 2. In Section 3 weprove that a modification of the algorithm proposby Schwiegelshohn et al. approximates the sumcompletion times within a factor 14.85 of optimal fanym.
2. Minimum makespan
The Garey–Graham algorithm [3] for RESOURCE
CONSTRAINED SCHEDULING with m = 1 works asfollows: We maintain an unsorted list of the jobs.there are resources available either at the beginninwhen a job finishes, we scan the list for a job which cbe executed with the resources now available. If this such a job, we start it on the machine and remit from the list. The running time is clearlyO(n2).
the list for jobs that can now be executed onpj . Theapproximation factor remains unchanged.
Theorem 1. Let ζ be the makespan returned by theGarey–Graham algorithm and let OPTbe the optimalvalue. Then ζ � 2 · OPT.
Proof. Letλi(t) := ∑x∈Ri(t)
ω(x) be the total load onmachinepi at timet . Of course we have:
m∑i=1
ζ∑t=1
λi(t) � OPT·m∑
i=1
C(pi). (1)
Consider two machinespi,pj ∈ P (i = j admissible).For t1, t2 ∈ N with t2 − t1 > OPT we haveλi(t1) +λj (t2) > C(pi). Since otherwise all jobs that are action pj at time t2 had been started onpi at time t1.Hence
OPT·m∑
i=1
C(pi) �m∑
i=1
OPT∑t=1
[λi(t) + λi(t + OPT+ 1)
]> OPT·
m∑i=1
C(pi),
a contradiction. �
3. Sum of completion times
3.1. Algorithm
Approximating the sum of completion timesmore elaborate. To state the algorithm we need smore notation generalising the concepts introduin [8]. A shelf Si = {Si,1, . . . , Si,m} is a set ofsub-shelves Si,j ⊆ J such that
∑x∈Si,j
ω(x) � C(pj ). Thelength of shelfSi is
τ (Si) := max1�j�m
maxx∈Si,j
τ (x),
i.e., the length of the longest job in all subshelves ofSi .Furthermore size(Si) := ∑m
j=1 |Si,j | denotes the totanumber of jobs inSi . A shelf assignment is a partitionof J into shelves and their subshelves. Throughoutdenote the shelf assignment ofJ by S = {S1, S2, . . .}.In essence a shelfSi represents a set of jobs which c
J. Remy / Information Processing Letters 91 (2004) 177–182 179
be processed in parallel on them machines. In doingso the machinepj executes the jobs inSi,j .
helfhelfdingree
y
m
tion
g
bsis
(3) Let S be the shelf assignment found in step two.In order to construct a scheduleF = (S,≺) we
-eds
n:
Given a shelf assignmentS, we can construct aschedule as follows: Fix a total order≺ on S, thenstart the shelves in this order so that all jobs of a sare started at the same time. The jobs of the next sare started as soon as the longest job of the preceshelf is finished. Fig. 1 shows such a schedule for thmachines. Thus, a schedule is defined byS and≺ andis equivalent to a solutionf . We denote a schedule bF = (S,≺) or F for short.
Now we are ready to formulate the algorithP-SMART which is a modification of the algorithmSMART [8] and works as follows:
(1) Divide the jobs into classesCi, . . . ,Ck wherek =maxx∈J �log3/2 τ (x)�. The job x belongs to theith class if and only if(3/2)i−1 < τ(x) � (3/2)i .More general, one could base the class distincon powers ofb > 1. But for our analysis,b = 3/2yields the best approximation ratio.
(2) For each classCi pack the jobs on shelves usinthe NEXT FIT INCREASING WEIGHT heuristicfor bin packing [2]. This means we sort the join Ci by increasing weight and pack them in thorder into the subshelves. In doing so firstSi,1 ispacked, thenSi,2 and so on. If all subshelves ofSi
are filled we start to packSi+1.
define a total order≺ on S. Due toSmith’s ratiorule [6,8] the optimal order is given bySi ≺ Sj ⇒τ (Si)
size(Si)� τ (Sj )
size(Sj ).
The running time isO(n logn) since we need tosort the shelves in the third step of the algorithm.
3.2. Analysis
Let C := ∑mi=1C(pi) and denote the sum of com
pletion times of the optimal schedule by OPT. If windex the jobs by area, we obtain two lower bounfor OPT [4,8] which still hold form > 1:
H :=∑x∈J
τ (x), (2)
A := 1
C
n∑i=1
i∑j=1
a(xj ) := 1
C
n∑i=1
α(xi). (3)
Let us denote an instance of RESOURCE CON-STRAINED SCHEDULING by I = (J,P, τ,ω,C). Forfurther analysis we need the following definitioGiven an instanceI = (J,P, τ,ω,C) of RESOURCE
CONSTRAINED SCHEDULING we define theroundedinstance as
I = (J,P, τ ,ω,C) whereτ (x) = (3/2)�log3/2 τ (x)�.
Fig. 1. A shelf assignment for 3 machines. All jobs of a shelf are started whenthe longest job on the preceding shelf terminates.
180 J. Remy / Information Processing Letters 91 (2004) 177–182
In other words, we round up the lengths of all jobsto the next power of 3/2 and leave everything else
.
hat
stng
utrinowt
andthat
e
tingte
Proof. Let y be an arbitrary job inJ2 and letTy ={x ∈ J : κ(x) = κ(y)}. Since we consider the rounded
bsby
stds
nee:
unchanged. P-SMART finds a shelf assignmentS forI which is identical toS except for the jobs’ lengthsWe denote the sum of completion times of(S,≺) byC which is clearly at leastC. Analogous we defineAandH . In general a hat over the symbol indicates tit addresses the rounded instance.
Furthermore, we partitionS into S1 andS2. For a(nonempty) classCi the shelf which was packed firbelongs toS1 whereas the remaining shelves beloto S2. J1 contains all jobs inS1, J2 those inS2.H1, H2, A1, A2, C1 andC2 are defined as usual, brestricted to jobs in the corresponding partition. Foexample,H1 is the sum of the lengths of all jobsJ1. The inequalities summarized in the lemma belare proved in [4] form = 1. One can easily verify thathey still hold form > 1.
Lemma 1. The following inequalities hold:
(1) A � 32A and H � 3
2H .
(2) C � C + H − H .(3) C1 � 3H1.
In the sequel we consider the rounded instanceassume that the jobs are indexed in such wayi < j implies a(xi) � a(xj ) for a(x) := ω(x)τ (x). Ifa x ∈ J is assigned to classCj in step 1 of P-SMART,then κ(x) = j . For a shelfS we defineκ(S) in thesame manner. Furthermore we define:
αR(xi) :=∑j�i
κ(xi)=κ(xj )
a(xj ).
For fixedy ∈ J2 we define a setS(y) = {S ∈ S2:κ(S) = κ(y)} that contains all shelves of the samclass asy.
We obtain a scheduleFR(y) by ordering theshelves inS(y) ascending by minx∈S ω(x). Since alljobs have the same length, this is equivalent to soraccording to minx∈S a(x). In this schedule we denothe completion time ofy by CR(y). Please keepin mind that the ordering inFR(y) is not optimal(Smith’s rule).
Lemma 2. For all y ∈ J2: CR(y) � 2C αR(y).
instance, all jobsx ∈ Ty have the same lengthτ whichis a power of 3/2. We sort the jobs inTy ascendingby weight and index them in this order. Since all johave the same length, this is equal to indexing themarea.
By φp,q we denote the job which is packed firto the q th machine in thepth shelf. Since we useNEXT FIT INCREASING WEIGHT to pack the shelvewe have:∑x∈Sp,q
ω(x) + ω(φp,q+1) > C(pq)
for 1� q < m, (4)∑x∈Sp,m
ω(x) + ω(φp+1,1) > C(pm). (5)
For the moment we assume thaty = xl was packedby NEXT FIT INCREASING WEIGHT onto the kthshelf. Within thosek shelves, there is also the first owhich belongs to the partitionS1. As a consequencthe completion timeCR(y) is (k −1)τ , and we obtain
αR(y) = τ∑i�l
κ(xi)=κ(y)
ω(xi) > τ
k−1∑p=1
m∑q=1
∑x∈Sp,q
ω(x)
= τ
k−1∑p=1
m−1∑q=1
∑x∈Sp,q
ω(x) + τ
k−1∑p=1
∑x∈Sp,q
ω(x)
> τ
k−1∑p=1
m−1∑q=1
(C(pq) − ω(φp,q+1)
)+ τ
k−1∑p=1
(C(pm) − ω(φp+1,1)
)= (k − 1)τ
(m−1∑q=1
C(pq) + C(pm)
)
− τ
k−1∑p=1
(m−1∑q=1
ω(φp,q+1) + ω(φp+1,1)
)� CR(y)C − αR(y). (6)
The claim follows. �Lemma 3. For schedule F2 we have: C2 � 2A.
J. Remy / Information Processing Letters 91 (2004) 177–182 181
Proof. Order the shelves inS2 due to
n
in
hat
n
ve
Theorem 2. Let C be the sum of completion timescomputed by P-SMART and let OPT be the optimal
y, itelf1–3
n
-edne.or
weu-a--eob-ne
of
S ≺ T ⇒ minx∈S
a(x) � miny∈T
a(y)
obtaining a scheduleFA. We denote the completiotime of a jobx ∈ J2 in this schedule byCA(x). Forthe next considerations we keep the following factsmind:
(1) Since this ordering is not optimal we haveC2 �∑x∈J2
CA(x).
(2) Recall that this ordering is the same as inFR(y)
for which CR(y) � 2C αR(y) holds due to Lem-
ma 2.(3) Furthermore, the jobs are still indexed such t
i < j ⇒ a(xi) � a(xj ).
Let xi0 be a job inJ2 with index i0 which waspacked into shelfX. For a classCj , let LX(Cj ) bethe last one of the shelves inCj which is executedin scheduleFA beforeX. If all shelves ofCj areexecuted afterX or κ(X) = j , then LX(Cj ) = ∅.Furthermore, letxij be the job with the least area oLX(Cj ). Let the classes with LX(Cj ) �= ∅ be indexedascending by the starting time ofxij in FA, sayC1, . . . ,Ck . Due to the ordering of the shelves we haa(xij ) � a(xij+1) � a(xi0) for all 1 < j � k. It is easyto verify that the completion time ofxi0 in scheduleFA is the sum ofCR(xi0) and
∑kj=1 CR(xij ). These
considerations lead to:
CA(xi0) =k∑
l=0
CR(xil )
� 2
C
k∑l=0
αR(xil ) = 2
C
k∑l=0
∑j�il
κ(xj )=κ(xil)
a(xj )
= 2
C
k∑l=0
∑j�i0
κ(xj )=κ(xil)
a(xj ) = 2
C
i0∑j=1
a(xj )
= 2
C α(xi0). (7)
With the jobs indexed by increasing area we have
C2 �|J2|∑i=1
CA(xi) � 2
C
|J2|∑i=1
α(xi) � 2A (8)
and the claim follows. �
value. Then C � 14.85· OPT.
Proof. In [4] it has been shown thatC � (δ + 1)C1 +(1/δ + 1)C2 holds for arbitraryδ > 0. The proof ofthis equation yields a more general result. Namelholds for any 2-partition of the jobs and arbitrary shassignments of the partitions. Thus, with Lemmaswe obtain:
C � C
� (δ + 1)C1 +(
1+ 1
δ
)C2
� 3(δ + 1)H1 + 2
(1+ 1
δ
)A
� 9
2(δ + 1)H1 + 3
(1+ 1
δ
)A
�[
9
2(δ + 1) + 3
(1+ 1
δ
)]OPT.
The optimal value forδ is√
6/3 and thus we have aapproximation within a factor 15/2+ 3
√6 ≈ 14.85 of
optimal. �
4. Concluding remarks
If we regard a shelfS as a job with lengthτ (S)
and weight size(S), then finding an optimal ordering for the shelves is equivalent to solving weightcompletion time scheduling on a single machiThis problem can be solved by starting the jobsshelves in the order proposed by Smith’s rule. Ifdo so, we obtain a 8-approximation [4]. Unfortnately Smith’s rule does not extend to multiple mchines. It has been proventhat weighted completiontime scheduling isNP-complete in the general cas[1] but Shmoys and Tardos showed that one cantain a 2-approximation for that problem [5]. So ocan easily derive a 16-approximation for RESOURCE
CONSTRAINED SCHEDULING if all processors haveequal capacity, i.e.,C(pi) = C(pj ): First generate theshelves, then schedule time with the algorithmShmoys and Tardos. Form = 1 the bound of 8 for thetotal completion time was achieved by using FIRST
182 J. Remy / Information Processing Letters 91 (2004) 177–182
FIT INCREASING AREA instead of NEXT FIT IN-CREASINGWEIGHT [4]. But for m > 1 our attempts to
.85.
l
tti-m-ty
go-p-
proximation Algorithms for NP-hard Problems, PWS Publish-ing, Warsaw, 1997.
ul-5)
u,ling,
witho-
n,
s-blef ther-
ar-ings-
apply this technique lead to bounds worse than 14
Acknowledgements
I would like to thank Angelika Steger for helpfudiscussion and comments.
References
[1] G. Ausiello, P. Crescenzi, G. Gambosi, V. Kann, A. MarcheSpaccamela, M. Protasi, Complexity and Approximation: Cobinatorial Optimization Problems and Their ApproximabiliProperties, Springer-Verlag, Berlin, 1999.
[2] E.G. Coffman, M.R. Garey, D.S. Johnson, Approximation alrithms for bin packing: a survey, in: D. Hochbaum (Ed.), A
[3] M.R. Garey, R.L. Graham, Bounds for multiprocessor scheding with resource constraints, SIAM J. Comput. 4 (3) (197187–200.
[4] U. Schwiegelshohn, W. Ludwig, J.L. Wolf, J. Turek, P.S. YSmart smart bounds for weighted response time scheduSIAM J. Comput. 28 (1) (1998) 237–253.
[5] D.B. Shmoys, É. Tardos, Scheduling unrelated machinescosts, in: Proceedings of the 4th Annual ACM–SIAM Sympsium on Discrete Algorithms, 1993, pp. 448–454.
[6] W.E. Smith, Various optimizers for single-stage productioNaval Research Logistics Quaterly 3 (1956).
[7] J. Turek, W. Ludwig, J.L. Wolf, L. Fleischer, P. Tiwari, J. Glagow, U. Schwiegelshohn, P.S. Yu, Scheduling parallelizatasks to minimize average response time, in: Proceedings o6th Annual ACM Symposium on Parallel Algorithms and Achitectures, 1994, pp. 200–209.
[8] J. Turek, U. Schwiegelshohn, J.L. Wolf, P.S. Yu, Scheduling pallel tasks to minimize average response time, in: Proceedof the 5th Annual ACM–SIAM Symposium on Discrete Algorithms, 1994, pp. 112–121.