Real-Time Job Scheduling in Hypercube Systemsy - CiteSeerX

1 downloads 3095 Views 203KB Size Report
*Dept. of Computer Science and Engineering. **Dept. of ... Pohang University of Science and Technology ... jobs in a hypercube system and propose a schedul-.
Real-Time Job Scheduling in Hypercube Systemsy O-Hoon Kwon*, Jong Kim*, SungJe Hong*, and Sunggu Lee** *Dept. of Computer Science and Engineering **Dept. of Electronic and Electrical Engineering Pohang University of Science and Technology San 31 Hyoja Dong, Pohang 790-784, KOREA Phone : +(82)-562-279-2257, Fax : +(82)-562-279-2299 E-mail : [email protected]

Abstract

As application areas that have real-time requirements become diverse and parallel processing becomes practical, advanced real-time systems are faced with the need for utilizing high-performance parallel processing systems. Moreover, hard real-time systems need sophisticated scheduling algorithms to decide the sequence of job execution, so that each job can be executed without violating its timing restriction. In this paper, we present the problem of scheduling real-time jobs in a hypercube system and propose a scheduling algorithm. The goals of the proposed scheduling algorithm are to determine whether all jobs can complete their processing before their xed deadlines in a hypercube system and to nd such a schedule. All jobs are considered to be aperiodic, independent, nonpreemptable, and ready to start execution at the time of invocation of the scheduling algorithm. Also, each job requests a subcube for the execution of its job and the processors requested by the job are used throughout the job's execution time. Hence, associated with each job is a computation time, a deadline, and a dimensional requirement. We show that determining a schedule such that all jobs meet before their respective xed deadlines in a hypercube system when preemption is not allowed is an NP-complete problem. We thus present a heuristic scheduling algorithm for scheduling non-preemptable real-time jobs in a hypercube system. Finally, we evaluate the proposed algorithm using simulation.

Keywords { deadline, feasible schedule, hypercube,

cessing, image processing, parallel simulations, realtime databases, and real-time systems using neural networks [10]. Two utmost concerns in such realtime systems are architecture and scheduling. The architecture problem is to provide sucient processing power for the real-time jobs waiting to execute and the scheduling problem is the problem of ordering those jobs to meet their deadlines. In recent years, the hypercube structure has received much attention as a parallel architecture because of its scalability, regularity, recursiveness, and rich topology that includes or matches the structure of many interesting problems [4]. Most of all, since a hypercube can be partitioned into subcubes, it is appropriate for the multiprogramming environment in which many programs are executed on di erent subcubes at the same time. Figure 1 shows a 4-dimensional hypercube system with three jobs executing. A job is a program executed in parallel on a set of processors. Examples of jobs are shown in Figure 1 as J1, J2, and J3. Each job is composed of several tasks executed on a processor. As usual, all jobs are assumed to be independent, but tasks in a job may be dependent. J3 0000

0001

As application areas that have real-time requirements become diverse and parallel processing becomes practical, advanced real-time systems are faced with the need to utilize high-performance parallel processing systems. Examples of such real-time parallel applications include robotics systems, digital signal pro-

y

This research was supported in part by KOSEF under Grant

96-0101-09-01-3.

P

0010

P

P

J3 0100

1000

J2 P 1010

P

J2

J3

real-time scheduling, subcube.

1 Introduction

P

J3

J2

J3

0011

1001

J2 P 1011

P

J1

J3

P

P

1100

0110

P

P 1110

J3

J3

J1 0101

P

P 0111

1101

P

P 1111

Figure 1: 4-dimensional hypercube with 3 jobs executing Managing computing resources in a hypercube system consists of two steps. First, a job must be chosen from among those waiting for execution (job schedul-

ing). Next, a particular free subcube within the hypercube must be allocated to that job (processor allocation). Many processor allocation algorithms have

been proposed for hypercube systems. They include the Buddy scheme, Modi ed Buddy, MSS, Gray Code, Free List, etc. [7]. On the other hand, job scheduling has been largely neglected. Recently, Krueger et al. [6] showed that job scheduling has far greater impact on performance than processor allocation. They found that choosing a suitable scheduling algorithm is far more important than nding an optimal processor allocation algorithm. Finding an optimal processor allocation strategy incurs a lot of overhead with little performance improvement. In contrast, a slight change in the scheduling algorithm can have a large performance improvement with little overhead. When a job has a deadline (known as real-time job), the problems of processor allocation and job scheduling become more complex. That is, the resource manager must not only specify an ordering of jobs to meet the deadline of each job, but must also determine the speci c processor to be used. Zhu and Ahuja [1] have studied the problem of real-time job scheduling in a hypercube system. In their research, they assumed that preemption is not allowed and all jobs in the job set have the same deadline. Even though the same deadline assumption is very strong and unpractical for real-time applications, the job scheduling problem in such a hypercube system is proven as NP-Complete [1]. If each job has its own deadline, the problem is exacerbated. In this paper, we consider the problem of scheduling hard real-time jobs in a hypercube system. Our research e orts are focused on the development of a suitable heuristic algorithm which can be eciently implemented. We consider a scheduling algorithm in a dynamic environment in which the algorithm has complete knowledge of currently active jobs, but new jobs, not known to the algorithm when it is scheduling the current set, may arrive. When a new real-time job enters the hypercube system, the schedulability of it for the current job set including the new job and jobs in the ready queue is tested. We propose a heuristic real-time scheduling algorithm for a hypercube system which supports the allocation of a subcube for each job. We also evaluate the proposed algorithm using simulation. The remainder of the paper is organized as follows. In Section 2, we give some preliminary de nitions. Section 3 describes the system model and de nes formally the problem discussed in this paper. Section 4 presents the proposed algorithm and an example of the algorithm. Section 5 analyzes the algorithm via simulation studies. Finally, in Section 6, we summarize this paper and give our concluding remarks.

2 Preliminaries

Let G = (V; E) be an m-dimensional hypercube. For every processor p 2 V , let pm pm?1 : : :p1 be the binary representation of p. Then a k-dimensional subcube, where 0  k  m, can be described by m ? k

xed bits and k \don't-care" bits. Let u and v be processors within an m-dimensional hypercube G, where u = um : : :u1 and v = vm : : :v1 in binary. And let [u; v] be the set of processors, whose binary representation are larger than or equal to that of u and smaller than or equal to that of v. Then, it is clear that [u; v] forms a k-dimensional subcube if i) um    uk+1 = vm : : :vk+1 , ii) uk : : :u1 = 00 : : :0, and iii) vk : : :v1 = 11 : : :1. In that case, [a; b] is said to be a basic subcube. Note that every k-dimensional basic subcube [a; b] can be divided into 2k?h h-dimensional basic subcubes (for some h  k). All the subcubes mentioned later in this paper are basic, so we will omit the word \basic" for simplicity.

3 System Model and Problem De nition 3.1 System Model

The system architecture considered in this paper is composed of a hypercube-connected system and a host computer as shown in Figure 2. The host computer is responsible for scheduling jobs, allocating jobs to subcubes, and deallocating jobs from subcubes. Therefore, the host computer is composed of the scheduler, the subcube allocator, and the subcube deallocator as shown in Figure 2. We assume that the time required in allocation and deallocation of jobs is bound by a constant time without regard to the size of the subcube and the size of the job. Host Computer Subcube Allocator Scheduler

Subcube Deallocator

M

M

M

M

M

PE

PE

PE

PE

PE

Hypercube Interconnection Network

Figure 2: System Architecture Given a set J = fJi : 1  i  ng of n independent hard real-time jobs to be run on an m-cube, a job Ji is characterized by the following three parameters:

 Ci { its computation time,  Di { its deadline,  Ri { its dimensional requirement. Real-time jobs are commonly characterized by their arrival time (or invocation time), computation time,

and deadline. Since the system decides the schedulability of a job at the time of job arrival (or invocation), the arrival time is not important in this paper. The above characterization means that a job Ji requires an Ri-dimensional subcube during Ci units of time and Ji must nish executing before the deadline Di . From the above characteristics, we can obtain another important characteristic, the laxity. The laxity (Li ) of a job Ji is the time obtained by subtracting its computation time (Ci) from its deadline (Di ). We assume all jobs are hard real-time, aperiodic, independent, nonpreemptable, and ready to start execution at the time of invocation of the scheduling algorithm [14]. We also assume that the resources requested by a job are used throughout the job's execution time. Based on the above system model, in the next subsection, we will de ne formally the problem studied in this paper.

3.2 Problem De nition

A schedule for a job set is said to be feasible if the execution of each job can be completed before its deadline. Given a scheduling algorithm, a job set is said to be schedulable if the scheduling algorithm generates a feasible schedule. If the current job set with a newly arrived job is schedulable, the new job is put into the ready queue. Otherwise, it is informed that the new job cannot be executed in this system. The real-time job scheduling (RTJS) problem in hypercube systems is to determine whether each job in a job set J can complete its execution before its deadline in a hypercube system and to provide such a schedule if it exists. In this paper we are only interested in non-preemptive scheduling, i.e., whenever a subcube is allocated to a job, it will be occupied until the job completes its execution. The real-time job scheduling problem in a hypercube system can be formally stated as follows:

Real-Time Job Scheduling(RTJS) in a hypercube system Instance : an m-dimensional hypercube and a list of jobs J = fJ1; J2;   ; Jng, where Ji = (Ci ; Di ; Ri), 1  i  n (Ci : compu-

and bottom of size 2m and a list of rectangles J = fJ1; J2 ;   ; Jng, where Ji is a rectangle (Ci  2Ri ) with a height limit Di Problem : determine whether every rectangle in J can be packed under its height limit and nd such an arrangement if it exists. It is an NP-complete problem to nd a feasible schedule in a real-time multiprocessor system [3, 9, 13, 14]. The optimal algorithm in real-time job scheduling is de ned as the one that may fail to meet a deadline only when no other scheduling algorithm can meet it [14]. The real-time job scheduling problem in a hypercube system is NP-complete since it contains the real-time scheduling problem in a multiprocessor system as a special case when all jobs need just one processor. In other words, the real-time scheduling problem in a multiprocessor system with one job per processor can be transformed to the real-time job scheduling problem in a hypercube system within polynomial time. Hence, we propose a heuristic algorithm in the next section which runs in polynomial time.

4 Real-time Job Scheduling Algorithm

In this section, we rst present a heuristic scheduling algorithm and then give an example of the algorithm in operation.

4.1 Overview of the proposed scheduling algorithm

The proposed scheduling algorithm consists of job scheduling and processor allocation. For processor allo-

cation, we use the BL (Bottom-Left) [2] scheme which is similar to the simple Buddy scheme. This is because the choice of processor allocation scheme does not result in a big di erence in the performance of the proposed scheduling algorithm.

J1

J3

J2

tation time, Di : deadline, Ri : subcube dimension) Problem : determine whether every job in J can complete its execution before its deadline and nd such a schedule if it exists.

If all requested subcubes are basic subcubes, this problem is equivalent to a variant of the two dimensional bin packing problem [5], which is as follows:

Two dimensional bin packing with height limits

Instance : a big rectangle with in nite height

J3 J3 J1 J2

J3 J3 J2 J2 J1 J4

Jn

J3 Jn

J3 J2 Jn

Figure 3: Scheduling search tree For job scheduling, we use a heuristic search algorithm. The heuristic search algorithm is based on the classical idea that scheduling is a search problem. The search space has a tree structure such as shown in Figure 3. Any intermediate vertex of the search

tree represents a partial schedule. Each leaf or terminal vertex represents a complete schedule. It is obvious that not all leaves represent feasible schedules. To nd a feasible schedule whenever one exists, we need an exhaustive search procedure, which is computationally intractable in the worst case. In many real applications, it is too time consuming to nd a feasible schedule using the exhaustive search. Moreover, we have to nd a feasible schedule quickly for realtime jobs. Hence, we use a heuristic approach. The heuristic search algorithm tries to determine a feasible schedule for a subset of jobs and then increases the size of the subset by including one more job at a time until all jobs are scheduled or the algorithm fails to nd a feasible schedule. The algorithm works as follows : It starts at the root of the search tree, which is an empty schedule, and extends the schedule (with one more job) by moving to one of the vertices at the next level in the search tree until a feasible schedule is derived. When moving to one of the vertices at the next level, we select the job with the smallest laxity among the remaining jobs. When extending the partial schedule at each level of search tree, the algorithm determines whether it is strongly-feasible or not. The de nition of strongfeasibility is as follows:

starting from Test. Here, if the partial schedule extended by Ji is feasible, the following inequality must be satis ed. Test + Ci  Di (4:1) Replacing Ci by Di ? Li according to the de nition of the laxity Li and solving the inequality of Eq. (4.1), we can get the following inequality. Test  Li (4:2) For Jj , in the same manner, we can obtain the following inequality. Test  Lj (4:3) Since both partial schedules extended by Ji and Jj are feasible, we need to test the feasibility of the job with the smaller laxity between the two jobs. In order to test for the strong-feasibility of the current schedule, we need to test only one job among the jobs requesting a subcube of the same size. Therefore, when testing the strong-feasibility of the current partial schedule in an m-dimensional hypercube system, at most m + 1 jobs are needed to test the strong feasibility. 2

De nition 1: (Strong Feasibility) [3] A partial

4.2 Data Structures

schedule is said to be strongly-feasible if all the schedules obtained by extending it with any one of the remaining jobs are also feasible.

The proposed scheduling algorithm uses the following three data structures. Note that the system is an m-dimensional hypercube system.

It may happen that a partial feasible schedule is found not to be strongly-feasible when the current partial schedule is extended by another job, say J. Then, it is appropriate to stop the search since none of the future extensions involving the job J will meet its deadline. However, it is possible to backtrack and to continue the search even after nding a non-stronglyfeasible schedule. Backtracking is done by discarding the current partial schedule, returning to the previous partial schedule, and extending it by choosing a different job. In our algorithm, we limit the number of backtracks to a certain number so that the algorithm nishes within a polynomial time. Note that the algorithm may fail to nd a feasible complete schedule by limiting the number of backtracks. From the following theorem, we know that the complexity of strong feasibility test is O(m) without regard to the number of jobs.

Figure 4: Data structures used by the scheduling algorithm

Theorem 1: (Strong Feasibility Test in a Hypercube System) When extending the partial sched-

 JList : A list of jobs already determined as

ule at each step of the algorithm in order to determine whether it is strongly-feasible or not, at most m + 1 jobs of the remaining jobs in an m-cube are sucient to test for strong feasibility. Proof. Let Ji and Jj be jobs requesting a kdimensional subcube. Let Test be the earliest start time for a job requesting a k-dimensional subcube. Then, when extending the current partial schedule, both Ji and Jj are to be allocated in the position

JList

J1

J2

CList(0)

Jn

CList(1)

J1

J4

CList(2)

J3

J n-1

CList(m)

J2

Jn

J5

schedulable. Jobs in the JList are linked in increasing order of laxity.  CList : CList consists of m + 1 independent lists, marked as CList(k), 0  k  m, in Figure 4. CList(k) is a list of jobs requesting a kdimensional subcube and waiting for scheduling. Jobs in the CList are linked in increasing order of laxity.

 ProcT : A rectangle of size p  q, where p is 2m

and q is the latest deadline among the jobs to be scheduled. Any allocated job Ji is represented as a box in ProcT that indicates what subcube to be used from what time to what time.

4.3 Scheduling algorithm

The inputs of the proposed algorithm are a new job Jnew , JList and CList, and the output of that is ProcT. We assume that there are n ? 1 jobs in JList and a new job Jnew arrives. The n ? 1 jobs in JList are already determined to be schedulable. The scheduling algorithm tries to nd a feasible schedule for n jobs including the new job Jnew . The new job Jnew is entered into JList and CList is also updated to re ect all n jobs. Let k be the number of allowed backtracks. The proposed scheduling algorithm is as follows:

Strong-Feasible-Scheduling

4.4 An Example of the Algorithm

Consider a 3-dimensional cube and a job set J with 5 jobs in increasing order of laxity. At this time, a new job J2 arrives into the system and the algorithm inserts J2 into JList and updates CList. Initially, JList and CList are as follows: JList = ; CList(0) = < >; CList(1) = ; CList(2) = ; CList(3) = ; The algorithm starts from the empty partial schedule. Obviously, < J1, J2 > is a strongly-feasible partial schedule. The ProcT after scheduling J1 and J2 in turn is shown in Figure 5. JList and CList at this point are as follows: time 1

2

3

4

5

6

7

8

0 processors

(Jnew ,JList,n,CList,m,ProcT,k) Insert Jnew into JList; for (job = 0; job < n; job++) for (backtrack=0; backtrack; CList(1) = ; CList(2) = ; CList(3) = ; Now, we try to extend the current strongly-feasible partial schedule with J3, the job with the smallest laxity among the remaining jobs in JList. We test the strong-feasibility of the current partial schedule < J1 , J2, J3 >, which is shown in Figure 6. If the current partial schedule < J1 , J2, J3 > is extended with J4 , which is the smallest laxity job among the remaining

jobs in CList(1), the extended partial schedule is not a feasible partial schedule. Hence, < J1 , J2 , J3 > is not strongly-feasible since J4 cannot complete before its deadline. time 1

2

3

4

5

6

7

8

0 processors

5.1 Job Set Generation

1 2

J1

3

J3

4 5

simulation process consists of two steps. First, assuming that the number of jobs is n and the dimension of hypercube is m, we generate a xed number of schedulable job sets which have at least one feasible schedule. Next, we count the number of job sets for which the algorithm nds a feasible schedule among the generated schedulable job sets.

J2

6 7

Figure 6: ProcT for < J1 , J2 , J3 > : An non-stronglyfeasible partial schedule At this time, a backtrack occurs. That is, we try to extend the current strongly-feasible partial schedule with J4 , the least laxity job among the remaining jobs except J3 in JList. We again test the strongfeasibility of the current partial schedule < J1 , J2, J4 >. If the current partial schedule < J1 , J2, J4 > is extended with J6 (CList(1)), J5(CList(2)), and J3 (CList(3)), all extended partial schedules are feasible partial schedules. Therefore, < J1 , J2, J4 > is proven to be strongly-feasible. At the end of the algorithm, we can get a feasible schedule such as shown in Figure 7.

What we are looking for is a scheduling algorithm that is able to nd a feasible schedule for a set of jobs, if such a schedule exists. Obviously, we do not guarantee that a heuristic algorithm can achieve this. However, one heuristic algorithm can be considered better than another if the former is able to nd feasible schedules for more job sets than the latter for a given a number of job sets with feasible schedules. This is the basis for our simulation study. It would be ideal to come up with a number of job sets, each of which is known to have at least one feasible schedule. Unfortunately, for any given arbitrary job set, only an exhaustive search can reveal whether the given set of jobs can be feasibly scheduled. Therefore, we take a di erent approach in our study here. We develop a job set generator that generates schedulable job sets where the number of jobs in a job set can be any number. The job set generation rst generates n rectangles within a big rectangle (similar tomProcT) whose width is in nite and whose length is 2 . The width of the rectangle represents time and the length of the rectangle represents the number of processors allocated, such as shown in Figure 8. In Figure 8, we denote the point with the processor i and time j as ProcT(i; j), where i and j are integers satisfying the condition that 0  i  2m ? 1 and j  1. The generation starts from the point ProcT(0; 0) with an empty big rectangle.

time 2

1

3

4

5

6

7

time

8

0

2

J1

J5

3

J3

4 5

J2

J6

2

3

4

5

6

J1 m-1

2 -1

6 7

processors

processors

1 0

1

J4

2

J2

Figure 7: The nal ProcT : A feasible schedule < J1; J2; J4; J3; J5 ; J6 >

5 Simulation

In this section, we evaluate the performance of the proposed algorithm by simulation. What we are interested in is the percentage of job sets for which a feasible schedule is found by the algorithm from all job sets that have at least one feasible schedule. Our

J4

m-1

m

J3

2 -1

Figure 8: The job set generation method The algorithm to generate n jobs in an mdimensional hypercube system is as follows:

Job-Generation-Algorithm (m,n) jobs = 1; for (time = 1; ;time + +) m for (proc = 0 ; proc < 2 ; proc++) if ProcT(time; proc) is OCCUPIED, skip this step; else Choose Cjobs between Min C and Max C; Choose Rjobs between 0 and Available; Choose Djobs between time+Cjobs -1 and time+Cjobs -1+Tightness; for (i = time; i