6
Information Processing North-Holland Letters 28 (1988) 183-188 29 July 1988 SCHEDULING TREE-STRUCTURED TASKS WITH RESTRICTED EXEC’U’I’ION TIMES Jianzhong DU and Joseph Y.-T. LEUNG Computer Science Program, University of Texas at Dab, Richarhon, TX 7.5080, U.S.A. Communicated by G.R. Andrews Received 21 May 1987 Revised 29 June 1987 and 28 March 1988 In this article we show that scheduling a tree-structured task system with two execution times in order to minimize the schedule length is strongly NP-hard for an arbitrary number of processors. If the execution times are powers of some integer r s 1, then the problem is NP-hard even for two processors. Keywork NP-completeness, NP-hardness, multiprocessor scheduling, schedule length, tree-structured task system 1. Pntmduction The complexity of scheduling a task system on a multiprocessor computing system so as to mini- mize the schedule length has been well studied in the literature. It is known that if the execution times of the tasks are arbitrary, then the problem is NP-hard even for a set of independent tasks to be scheduled on two processors [il. On the other hand, if the tasks have identical execution times, then the problem is polynomially solvable for a tree-structured task system [5]. For arbitrary task systems, the problem is polynomialiy solvable for two processors [3], but it becomes NP-hard for an arbitrary number of processors [g]. The complex- ity of the problem is still open for a fixed number of processors larger than two. Recently, there has been some interest in de- termining the complexity of this scheduling prob- lem when the execution times of the tasks are restricted. Ullman [8] has shown that if the execu- tion times are either one or two units, then the problem is NP-hard for an arbitrary task system to be scheduled on two processors. Leung [6] has shown that the problem is polynomially solvable for a set of independent tasks having a fixed number of different execution times. Coffman, Garey and Johnson [2] have shown that the prob- lem is polynomially solvable for a set of indepen- dent tasks whose execution times form a divisible sequence. (A set of execution times is said to form a divisible sequence if a larger execution time is always an integer multiple of a smaller one.) The complexity of tree-structured task systems is not well-understood, although Nakajima, Leung and Hakimi [7] have shown that the problem is poly- nomially solvable for two processors and the ex- ecution times being one or two units. In this article we give sharper complexity re- sults for three-structured task systems. We show that if the execution times are either 1 or K units, where K is arbitrary, then the problem is strongly NP-hard for an arbitrary number of processors. Furthermore, if the execution times are powers of some integer r > 1, then the problem is NP-hard even for two processors. It should be noted that the case of execution times being powers of some integer is a special case of divisible execution-time sequence. 2. Main results In this section we show that the following two decision problems are NP-complete, thereby 002@-0190/88/$3.50 @ 1988, I&e&r Science Publishers FL?. (North-H~!!rzd) 183

Scheduling tree-structured tasks with restricted execution times

Embed Size (px)

Citation preview

Page 1: Scheduling tree-structured tasks with restricted execution times

Information Processing North-Holland

Letters 28 (1988) 183-188 29 July 1988

SCHEDULING TREE-STRUCTURED TASKS WITH RESTRICTED EXEC’U’I’ION TIMES

Jianzhong DU and Joseph Y.-T. LEUNG

Computer Science Program, University of Texas at Dab, Richarhon, TX 7.5080, U.S.A.

Communicated by G.R. Andrews Received 21 May 1987 Revised 29 June 1987 and 28 March 1988

In this article we show that scheduling a tree-structured task system with two execution times in order to minimize the schedule length is strongly NP-hard for an arbitrary number of processors. If the execution times are powers of some integer r s 1, then the problem is NP-hard even for two processors.

Keywork NP-completeness, NP-hardness, multiprocessor scheduling, schedule length, tree-structured task system

1. Pntmduction

The complexity of scheduling a task system on a multiprocessor computing system so as to mini- mize the schedule length has been well studied in the literature. It is known that if the execution times of the tasks are arbitrary, then the problem is NP-hard even for a set of independent tasks to be scheduled on two processors [il. On the other hand, if the tasks have identical execution times, then the problem is polynomially solvable for a tree-structured task system [5]. For arbitrary task systems, the problem is polynomialiy solvable for two processors [3], but it becomes NP-hard for an arbitrary number of processors [g]. The complex- ity of the problem is still open for a fixed number of processors larger than two.

Recently, there has been some interest in de- termining the complexity of this scheduling prob- lem when the execution times of the tasks are restricted. Ullman [8] has shown that if the execu- tion times are either one or two units, then the problem is NP-hard for an arbitrary task system to be scheduled on two processors. Leung [6] has shown that the problem is polynomially solvable for a set of independent tasks having a fixed number of different execution times. Coffman,

Garey and Johnson [2] have shown that the prob- lem is polynomially solvable for a set of indepen- dent tasks whose execution times form a divisible sequence. (A set of execution times is said to form a divisible sequence if a larger execution time is always an integer multiple of a smaller one.) The complexity of tree-structured task systems is not well-understood, although Nakajima, Leung and Hakimi [7] have shown that the problem is poly- nomially solvable for two processors and the ex- ecution times being one or two units.

In this article we give sharper complexity re- sults for three-structured task systems. We show that if the execution times are either 1 or K units, where K is arbitrary, then the problem is strongly NP-hard for an arbitrary number of processors. Furthermore, if the execution times are powers of some integer r > 1, then the problem is NP-hard even for two processors. It should be noted that the case of execution times being powers of some integer is a special case of divisible execution-time sequence.

2. Main results

In this section we show that the following two decision problems are NP-complete, thereby

002@-0190/88/$3.50 @ 1988, I&e&r Science Publishers FL?. (North-H~!!rzd) 183

Page 2: Scheduling tree-structured tasks with restricted execution times

Volume 28, Number 4 INFORMATION PROCESSING LETTERS 29 July 1988

establishing the NP-hardness results claimed in Section 1.

(PI). Given m 2 1 identical processors, positive in-

tegers D and K, and a set of tasks TS =

(T,, T2,==., T,> with its precedence graph G = (TS, E ), where G is a tree and the execution time p( q ) of each task T is either 1 or K units, is there a schedule of TS on m identical processors with a schedule length of D or less?

[m(r)]. Given a positive integer D, and a set of tasks TS = (T,, T2,. . . , Tn ) with its precedence graph G = (TX E ), where G is a tree and the execution time p(T.) of each task T. is a nonnega- tive integer power of r, is there a schedule of TS on two identical processors with a schedule length qf D or less?

2.1. Theorem. Problem [Pl] is strong& NP-com- plete.

hmf. [Pl] is clearly in NP. To complete the proof, we shall reduce the ~-PARTITION problem to it. The ~-PARTITION problem Alas been shown to be strongly NP-complete in [<{ and is stated as follows: Given a list of integers A = (aI, a2,. . . ,

a&, where X::“,ak ==z*B and iB<a,<iB for each 1~ k < 3 * z, is there a partition of A into Ai = (ail, ai2, ai3), 1~ i < t, such that E;=iaij = B foreach l<i<z?

Given an instance ,4 of the ~-PARTITION prob- lem, we construct a task system as shown in Fig. 1 andlet m=z+f, K=z*B atid D=6*.z*K+ B + 1. The task system has exactly 6 * z * m K-unit tasks and m * B + 1 l-unit Phsks. The root R is a l-unit task. There is a chain of ak l-unit tasks for each integer ak of A. We use c( a,) to denote this chain. Fina&, there is a chain of B l-unit tasks attached to the end of task ‘u; + =. (Incidentally, the longest path in the task system is the one that starts from the root R, and ends at the last task of this chain of B l-unit tasks.) These are all the l-unit tasks in the task system. For each 1 < k < 3 * z and 1 f 1~ z, we use C(k, 1) to denote the chain of tasks starting from task X,,, and ending with task Y&. It is easy to see that the transforma- tion can be done in polynomial time.

We first show that if the instance of the ~-PAR-

TITION problem has a solution, then the con-

184

str-ucted instance of [PI] has a solution. Let a solution of the ~-PARTITION problem be given by Ai = (ail, ai2, ai3), 1 < i < z. We construct a solu- tion for the instance of [Pl] as follows. The tasks on the longest path (which has a length of D) will be scheduled on the mth processor. Observe that, for each 1~ k < 3 * z, the chains C(k, I), 1 G 1~ z, are ready for execution at time 1 + 2 *(k - 1) * K. For each 1~ k < 3 * z we schedule the tasks on chain C(k, 1) on processor i if ak is a member of Ai, the tasks on chain C( k, i) on processor 1, and the tasks on chains C( k, I), I+ 1, i, on processor 1. The tasks are s&duled on the processors as soon as the processors are available for processing. It is easy to verify that the schedule has length D.

Next we show that if the constructed instance of [Pl] has a solution, then the instance of the ~-PARTITION problem must have a solution. Let s be a schedule of the task system on m processors with length D or less. Since the length of the longest path in the task system is D, the tasks on this path must be continuously executing in S from time 0 until D. We may assume that they are all executed on the mth processor in S; for, otherwise. we can swap tasks among processors to achieve this. Hence, the chains C(k, 1), 1~ k < 3 * z and 1 < 1~ z, must be executed in S on processors 1 to m - 1 in the time interval [l, D]. The total execution time of all the tasks in these chains is (m - 1) *(D - 1). Thus, S cannot have any idle processor time in the interval [I, D]. Dictated by the values of D and K, each processor in S must execute 6 * z K-unit tasks and B l-unit tasks in the interval [l, D]. If we can show that the l-unit tasks executed on processcA I, 1~ i < m - I, correspond to three chains c( ai* ), c( ai2), and C(ai3), then Ai = (ail, ai2, ais), 1~ i < Z, con- stitutes a partition of A.

To show the above, it is sufficient to show that when the first task in each chain c( a,), 1 < k < 3 * z, gets executed in S, then the entire chain will be executed continuously until the last task in the chain is finished. By swapping tasks among processors, we can transform the schedule so that each chain is executed entirely on a single processor, and hence the claim is proved. In S, each task Yk, 1 < k < 3 + z, is executed in the time interval [(2*k-l)*K+1,2*k*K+l] on the

Page 3: Scheduling tree-structured tasks with restricted execution times

Volume 28, Number 4

R

Y 32-2

X 32-l

Y 32-l

Y A 3t

Y 32

c(B)

Legends :

T

44

INFORMATION PROCESSING LETTERS

4 h+ A task named by T with p(T) = t.

b t

A chain of k l-unit tasks.

I3 ai

Fig. 1. Reduction in Theorem 2.1.

mth processor. Since S does not have idle processor time in the interval [l, D], it is easy to show that the tasks Yk,,, 1~ I < z, must start in the interval [(2 * k - 1) * K + 1, 2 * k * K + 1). Consequently, the tasks Xk,,, 1~ I < z:, must also finish in the interval[(2*k-1)*#+1,2*k*K+l).Thus,in the interval [(2*k-l)*K+1,2*k*K+l), the number of processors available for assignment is exactly the same as the number of tasks that are

# 0 c(ai)

29 July 1988

ready for execution. Hence, the execution of chain ~(a,) cannot be interrupted; for, otherwise, S would have idle processor time. 0

2.2. Theorem. Problem [P2(r)] is NP-complete for each integer r > 1.

Btoop. [P2( r)] is clearly in NP for each integer r > 1. To complete the proof we shall reduce the PARTITION problem to it. The PARTITION problem

185

Page 4: Scheduling tree-structured tasks with restricted execution times

Volume 28, Number 4 INFORMATION PROCESSING LETI’ERS

. . . . . . . . . ..* . . .

c (a,-1)

V 8 z-l T

Fig. 2. Reduction in Theorem 2.2.

is known to be NP-complete [4] and is stated as follows: Given a list of integers A = (a,, a 2, . . . 9 ar), where &,a, = B, is there a partition of A into A, and A, such that C,,, A,ak = C,, E Azak = qB?

Given an instance A of the PARTITIOY 1 problem, we construct a task system as shown in Fig. 2 and let D=2*z*r*C+gB+l, where C=ri such that 8-l < B < ri. The tree shown in Fig. 2 is actually a caterpillar with the spline being

(R, X,, &...,Zl,r, X,9 &,,,-,

The root of the tree R has an execution time of 1 ~5. The tasks Zk./, l,<k<z and l<l<r, have

29 July 19W

A task named by T with p(T)=t.

A chain of tasks each with exec. time an integer power of 'r such that the total exec. time is ai.

execution times C units. The tasks X,, 1~ k < z, have execution times r * C units. We let I”‘, 1 < k 6 z, denote the chain of tasks ( Zk,,, Zk,2,. . ., &). For each integer uc, of A we create a chain of at most log, ak tasks, each of which has execu- tion time an integer power of r, such that the total execution time Of these iasks is ak. We let c( ak) denote this chain of tasks. There are z ‘hairs’ hanging from the spline of the caterpillar. The first one hangs from R and consists of task U,, followed by chain c( u,)~ followed by task V,. The

Page 5: Scheduling tree-structured tasks with restricted execution times

Volume 28, Number 4 INFORhdATION PROCESSING LETTERS 29 July 1988

next z - 1 ‘hairs’ hang from &_i, 1~ k < z - 1, and consist of task V”, i, followed by chain c( ++i), followed by task &.+i. For each 1 < k < z, tasks uk and v, have execution times Y * C units. It is easy to see that the construction can be done in time polynomial to the size of the given in- stance of the PARTITION problem.

We first show that if the instance of the PARTI- TION problem has a solution, then the constructed instance of [P2(r)] has a solution. Let A, and A, be a solution of the PARTITION problem and, without loss of generality, assume that a1 is in A,. We construct a schedule for the instance of [P2(r)] as follows. We schedule R, U,, c( aI), and Vi continuously on the first processor, starting at time 0. We schedule X, and Yi continuously on the second processor, starting at time 1. For each 2 f k < Z We schedule the ‘hair’ (u,, c( ak), vk) on the first processor if ak k in AI; otherwise, it will be scheduled on the second processor. These ‘hairs’ will be scheduled continuously on the processors as soon as the processors become free for assignment. The tasks xk and Yk will be scheduled on the second processor if ak is in A,; otherwise, it will be scheduled on the first processor. These tasks will be scheduled continu- ously on the processors as soon as the processors become free for assignment. We leave it to the reader to verify that the constructed schedule satisfies all precedence constraints and has sched- ule length D.

Next, we show that if the constructed instance of the [P2(r)] problem has a solution, then the instance of the PARTITION problem must have a solution. Let S be a schedule of the task system on two processors with a schedule length of D or less. In S, root R must be executed in the first time unit and all other tasks must be executed after the first time unit. Since the total execution time of all tasks, except the root, is 2 *(D - l), there must be no idle time in the time interval [l, D] in S. Let PE denote the set of tasks in the chains c( ak), 1 < k < z. Let Fi (respectively &) denote the set of tasks in PE executed on processor 1 (respectively processor 2) in S, and let 1 Fl 1

(respectively 14;; I) denote the total execution time of all the tasks in Fi (respectively &). Dictated by the value of D and the execution times of the

tasks in the task system, we must have I & I =

IF2I = f B. From the Claim shown below we see that the tasks in c( ak), 1 G k G z, execute continu- ously in a time interval Of length ak in s. By swapping tasks among processors, we can trans- form the schedule so that each chain is executed entirely on a single processor. Thus, A, =

{akIc(ak>EFl} and A2=(a&(ak)H2} Con-

stitute a partition of A.

Claim. In S, the following statements are true for each 1 <k<z:

(1) All the tasks that start at or after the finish- ing time of &,_ 1 are suaessors of &_i,

(2) the finishing times of vk and zk r_ 1 are 2*k*r*C+H~+land2*k*r*C+~~+l- C, respectively, where Hi (respectively H,f ) is the total execution time of the tasks in PE that execute before the finishing time of vk (respec- tively zk,,_ r ) on the same processor as v, (respec- tively zk,,- t ),

(3) the starting time of zk r is the same as the finishing time of zk,,_ i, and ’

(4) the tasks in c( a,) execute continuously in a time interval of length ak_

The Claim can be proven by induction on k. Due to space limitation, we shall omit its proof. cl

3. Concluding remarks

In this article we have shown NP-hardness re- sults for the problem of minimizing the schedule length of tree-structured task systems with very restrictive task execution times. For future re- search efforts, it will be interesting to determine the complexity of problem [Pl] for a fixed number of processors and/or for fixed value of K. Also, it will be interesting to see if problem [P2(r)] is ~+rongly NP-hard.

References

[l] E.G. Coffman, Jr., Computer and Job-Shop Scheduling The- ory (Wiley, New York, NY, 1976).

[2] E.G. Coffman, Jr., MR. Garey and D.S. Johnson, Bin p&king with divisible item sizes, J. Complexity, to appe=

187

Page 6: Scheduling tree-structured tasks with restricted execution times

Volume 28, Number 4 INFORMATION PROCESSING LETI’ERS 29 July 1988

[3] E.G. Coffman, Jr. and RL. Graham, Optimal scheduling for two processor systems, Acta Informaticc 1 (3) (1972) 200-213.

[4j M.R. Garey and D.S. Johnson, Computers and Intracta- bility: A Gui& to the Tireory of NP-Completeness (Freeman, San Francisco, CA, 1979).

!S] T.C. Hu, ParaIIel sequencing and assembly Iine problems, Operations Research 9 (6) (1961) 841-848.

16) J.Y.-T. Leung, On scheduhng independent tasks with re-

stricted execution times, Operations Research 30 (1) (1982) 163-171.

(71 K. Nakajima, J.Y.-T. Leung and S.L. Hakimi, Optimal two processor scheduling of tree precedence constrained tasks with two execution times, ?erformance Evaluation 1 (4) (1981) 320-330.

[8] J.D. Ulhnan, NP-complete scheduling problems, J. Com- put. System Sci. 10 (1975) 384-393.

188