The complexity of preemptive scheduling given interprocessor communication delays

The complexity of preemptive scheduling given interprocessor communication delays

InformaUon Processing Letters 25 (1987) 123-125 North-Holland 6 May 1987 T H E C O M P L E X I T Y O F P R E E M P T I V E S C H E D U L I N G GIVEN...

232KB Sizes 39 Downloads 60 Views

InformaUon Processing Letters 25 (1987) 123-125 North-Holland

6 May 1987

T H E C O M P L E X I T Y O F P R E E M P T I V E S C H E D U L I N G GIVEN I N T E R P R O C E S S O R C O M M U N I C A T I O N DELAYS V.J. R A Y W A R D - S M I T H School of Informauon Systems, Unwersttyof East Angha, Norwwh NR4 7TJ, Umted Kingdom Commumcated by P Henderson Received 24 September 1986

We discuss the problem of scheduling a set of independent tasks T, each t, ~ T of length dt E Z +, on m ldenucal processors We allow preemption but assume a communication delay of tame k ~ NI Whenever a task is preempted from one processor to another, there must be a delay of at least k tmae umts We show that if k = 1, an optmaal schedule can be found m polynomaal tmie but ff k >1 2, the corresponding declsaon problem is NP-complete

Keywords Preemptive schednlmg, commumcation delay, multiprocessor system, NP-completeness, algorithm analysts, heuristic programming

Let T be a set of n independent tasks such that each t~ ~ T has an associated processing ttme (length) E, ~ Z +, the set of positive integers. In this paper, we are concerned with scheduling such a set of tasks on m > 1 identical processors P1, P2,---, Pro" Assuming all processors are available at ttme t = 0, the completwn Ume, C j, of any processor Pj is the earhest time by which it can process all the tasks allocated to it. We say the length of the schedule is max{Cj I1 ~
Basic scheduhng theory [2,4] considers two possible sRuations. Ftrst, nonpreemptwe scheduhng is where every task t, ~s allocated to just one processor. The decasion problem assocaated with finding an optimal nonpreemptive schedule is known to be NP-complete [6]. Alternatively, we have preemptwe scheduling where a task t~ ~ T can be partitioned (preempted) into subtasks tl, t l2) " . . , t x, (X,>~l) of length d,l, da,. " ' ' 4x, where each :u ~ Z + and 5-'x:leu = e,. Each of these subtasks xs run without further preemption of any one of the processors subject to the constraint that t~ cannot be started before t~- ~ is completed for

all 1 < j ~~ 1 ) o n l y if either (a) t~ -1 and t~ are run on the same processor and start-time (t~) > / c o m p l e t i o n - m e (t~-l), or (b) t~ -1 and t~ are run on the same processor and start-tune (t~) >/completion-time (t~ -1) + k for all 1 < j < X,. We define ~0k to be the length of the optimal schedule for the set T of tasks assuming a communication delay of k >I 0. With no communication delay, the optimal schedule is of length o~0 as is defined m (1). The length of the optimal non-

0020-0190/87/$3.50 © 1987, Elsevter Scaenc¢ Pubhshers B.V (North-Holland)

123

Volume 25, Number 2 0

k

INFORMATION PROCESSING LETTERS 2k

3k

A n y schedule is defined by a function {1, 2,.

P1

6 May 1987

,L} × { 1 , 2 ,

,m}~T

tl

F~g 1

To show that k-DELAYSCHEDULINGE NP, we simply try all possible functmns checking each to see if it describes a valid k-delay schedule To prove that k-DELAY SCHEDULING IS N P complete, we then need to construct a polynomial t r a n s f o r m a t m n from a k n o w n NP-complete problem The problem we use is 3-PARTITION described as follows.

preempUve schedule is d e n o t e d by to. Then, by using the w r a p - a r o u n d algorithm but only after allocating a n y task of length too = t°l to Its own processor, it follows that too = to1 and an optimal 1-delay schedule can be f o u n d m polynomial u m e A n o t h e r sunple mochflcaUon to the w r a p - a r o u n d algorithm estabhshes that, for any k >/1,

3-PARTI~ON INSTANCE" Set A of 3p elements, b o u n d b ~ Z + a n d size s(a) ~ Z + for each a ~ A such that ¼b < s(a) < ½b, where pb = 5"-a ~ A s(a) QUESTION: Can A be partitioned into p disjoint sets A1, A 2 , . ,Ap such that, for 1 ~
t3

tok ~< miD{ too + ( k - 1), to}. It is easy to construct a set of tasks for which tok = ¢°0 + (k - 1) for any k ~< m. Consider k + 1 tasks of length k and m - k tasks of length k + 1 It is also clear that there exists an integer a, l/1 even for m = 2 processors. Consider T = {t 1, t 2, t 3 } where d 1 = d2 = ~3 = 2k T h e optunal k-delay schedule is of length 3k as descn'bed m Fig. 1. To get a schedule of length 3k, at least one task must be preempted. However, with a n y such preemption, a (k + 1)-delay schedule wall have length >/3k +1. We n o w prove that the m a r e result of tbas paper, vlz. that the following p r o b l e m is N P - c o m plete for k >1 2. k-DELAY S c m m a t m m G INSTANCE: Set T of tasks, each t, ~ T of length d 1 ~ / ' +, a b o u n d L ~ Z + a n d a n u m b e r of maclunes, m > 1. QUESTION: IS there a vahd schedule of the set of tasks T o n the m machines with length ~< L and with an mterprocessor c o m m u n i c a t i o n delay of k tune units? 124

(Note that this tmphes that there are exactly three elements m each set.) 3-PARTITION has been shown to be u n a r y N P complete [6], i.e., even if the integers revolved are represented In u n a r y notation, the problem is still NP-complete. Given an instance I of 3-PARTITION, we construct an instance f(I) of k-DELAY SCHEDULING for k >/2 as follows: (1) T = A t3 T 1 is such that: (a) for each a ~ A, d(a) = k s(a) + b, (b) T 1 comprises 2pb tasks of length (k + 1)b - 1 (2) L = (k + 1)b. (3) m = p(2b + 1). If instance I of 3-PARTITION IS represented m u n a r y notation, then the length of f(I) is polynormal m the length of I, l:e., f is a polynomial transformation. We need to establish that I ~ YD-P^Rr,rlON, i.e., that I is a YES instance of 3-PARTITION iff f(I) Yk-DELA*Sc,EDUL,,~O,I.e., that f(I) is a YES instance of k-DELAY SCHEDULING First, we observe that, m f(I), the total processing time = = L m = (k + 1)bp(2b + 1)

Volume 25, Number 2

INFORMATION PROCESSING LETFERS

and the total length of tasks = = E

e ( a ) + 2 p b ( ( k + 1 ) b - 1)

a~A

= Y'. k s ( a ) + 3pb + 2pb((k + 1)b - 1) a~A

= p b ( k + 1)(2b + 1). Thus, the b o u n d can only be achieved ff there is no Idle tmae whatsoever. Now, we can prove I ~ Y3-PAaTXr,o~ =~ f(I) ~ Yk-DELAYSCHEDULI/qG" A can be p a r t m o n e d into p sets A,, 1 ~< 1 < p, of three elements, each of winch satasfles ~'a E A, s(a) = b. For each of these p sets, we allocate a single m a c h i n e to process a part of each a ~ A~ called the resMue of a and defined by r(a) = (k + 1)s(a). Then, for each a ~ A~, we allocate the remaining b - s(a) umts of the task in one unit chunks to b - s(a) processors each of which spends the rest of its time processing a task of length L - 1 from T 1 If A 1 = {aa, a2, a3}, some processor is allocated tasks as follows:

i

r(al)

r(a2)

r(a3)

W e reqmre exactly p processors to process these residues Smce r(a) + ( k + 1 ) ( b - s ( a ) )

= ( k + 1 ) b = L,

we can allocate the tasks to processors as we have described even with an mterprocessor c o m m u m c a tion delay of k time units. Moreover, since Ea ~ A (b - s(a)) = 2pb a n d T 1 comprises 2pb tasks, the n u m b e r of processors we reqmre ~s m = 2pb + p Hence, this allocatmn shows that f(I) ~ Yk-DEL^VScHEVULZNO To show f(I) ~ Yk-D~L*VScHEDULI~O :=:' I ~ Y3-P~R.moN, we observe that we can waste no processor ttme nor can we p r e e m p t a n y task in T 1. Hence, 2pb processors m u s t each be dechcated to processing one task m T 1 and one unit of a task in A. Thus,

6 May 1987

each task a in A must be p r e e m p t e d into the m a x i m a l n u m b e r of umt tasks, wz. b - s(a) and a residue (k + 1)s(a). Since we have no idle time, we m u s t allocate exactly three residues to each of the r e m m m n g p processors The 3p tasks whose residues are assigned to these p processors are thus p a r t m o n e d into p sets A,, 1 ~< 1 ~ p, of three elem e n t s each satisfying E

r(a)=(k+

a~A,

1)b

andhence

E

s(a) = b

a~A,

Thus, I E Y3-P, Rvsr~o~W e have thus established the followang result.

For k >t 2, k-DELAY SCHEDULING ts NP-complete. Theorem.

T h e practical imphcatlon of tins result is that it is inghly u n h k e l y that there is a polynormal ttme algorithm to find an optimal k-delay schedule for the general case. Of course, tins does not m e a n that there is no such algorithm for special cases. F o r example, consider the case where there are no tasks of length > t o o - k; the w r a p - a r o u n d algorithm will always yaeld a vahd k-delay schedule of length too However, for the m o r e general case, suitable heunsUcs will be required.

References

[1] T. Agerwala, Commumcauon, computauon and computer architecture, Proc Internat Commumcauons Cord (1977) 209-215 [2] E.G Coffman, Jr., ed, Computer and Job Shop Scheduling Theory 0Ndey, New York, 1976) [3] D H Comett and M A Frankhn, Scheduling independent tasks with commumcaUons,Tech Rept, Dept of Electrical Engineering, Washington Umv, 1979 [4] M A.H. Dempster, J K Lenstra and A.H.G Rmnooy Kan, Deterrmmstac and StochasUcScheduling, NATO Advanced Study Insutute Series (Reldel, Dordrecht, The Netherlands, 1981) [5] M. Dl&c, P. Kohlhepp and R. Oberle, Performance analyms of a &stnbuted real tune system, IEEE Real-Trine System Syrup, Los Angeles (1982) 57-68 [6] M R Garey and D.S Johnson, Computers and Intractabd~ty A Grade to the Theory of NP-Completeness (Freeman, San Francisco, CA, 1979) [7] R. McNanghton, Scheduling with deadlines and loss functmns, Management So 6 (1959) 1-12 125