Journal of Computer Systems, Networks, and Communications

VolumeΒ 2008, Article IDΒ 578180, 9 pages

http://dx.doi.org/10.1155/2008/578180

## Scheduling Algorithm: Tasks Scheduling Algorithm for Multiple Processors with Dynamic Reassignment

^{1}Department of Research Planning and Business Development, Central Building Research Institute, Roorkee 247667, Uttarakhand, India^{2}Department of Mathematics and Statistics, Gurkula Kangari University, Hardwar 249404, Uttarakhand, India

Received 5 September 2007; Revised 17 January 2008; Accepted 19 March 2008

Academic Editor: Y. -M.Β Huang

Copyright Β© 2008 Pradeep Kumar Yadav et al. This is an open access article distributed under the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.

#### Abstract

Distributed computing systems [DCSs] offer the potential for improved performance and resource sharing. To make the best use of the computational power available, it is essential to assign the tasks dynamically to that processor whose characteristics are most appropriate for the execution of the tasks in distributed processing system. We have developed a mathematical model for allocating ββ tasks of distributed program to ββ multiple processors () that minimizes the total cost of the program. Relocating the tasks from one processor to another at certain points during the course of execution of the program that contributes to the total cost of the running program has been taken into account. Phasewise execution cost [EC], intertask communication cost [ITCT], residence cost [RC] of each task on different processors, and relocation cost [REC] for each task have been considered while preparing a dynamic tasks allocation model. The present model is suitable for arbitrary number of phases and processors with random program structure.

#### 1. Introduction

Over the last several years, distributed computing systems have become popular as a very attractive option for fast computing and information processing. Distributed computing system is used to describe a system whenever there are several computers interconnected in some fashion so that a program or procedure runs on the system with multiple processors. In a heterogeneous computing system, the tasks of an application program must be assigned to the heterogeneous processors to utilize the computational capabilities and resources of the system efficiently. However, it is a difficult problem to compute an assignment of tasks to processors for which the total cost of running the program is minimized. Static and dynamic algorithms can be extremely efficient in homogeneous systems. If all processors are identical then the choice βto which node should we assign the next task?β falls on the processor with the fewest outstanding jobs [1]. However in heterogeneous distributed environments, where not all nodes have the same parameters, selecting the optimal target processor requires more elaborate algorithms.

Stone [2] has suggested an efficient optimal algorithm for the problem of assigning tasks to two processors by making use of the well-known network flow algorithm in the related two-terminal network graphs. If the structure of a distributed program is constrained in certain ways, it is possible to find the optimal assignment over a system made up of any number of processors in polynomial time. When the structure is constrained to be a tree, the shortest tree algorithm developed by Bokhari [3] yields the optimal assignment. Towsley [4] generalized the results of Bokhari to the case of series-parallel structures. A further generalized program structure is a partial K-tree in which trees are partial l-tree and series-parallel structures are partial 2-tree [5] assuming distributed system as fully interconnected, that is, there exists a communication link between any two machines. However, the general -processors problem in a fully interconnected system is known to be NP-complete [6, 7]. Lee et al. [8] and Cho and Park [9] have suggested an optimal algorithm for the general structure problem in a linear array network with any number of processors.

All the above assignment models are static because they assume that once a task is assigned to a processor, it remains there statically during the execution of a distributed program. These models deal with the global information, which is assumed to be constant during the program execution, of programβs activity. However the static model assumes that the problem can be partitioned into several tasks each of which contains a unique computational characteristic. In a general case each task may have multiple computational characteristics due to the dynamic control behavior ofthe task. Such tightly and medium-coupled portions of code task will be more difficult to break up and assign to different processors. When the characteristics of the computation change, a new assignment must be computed. By βcharacteristics of the computationβ we mean the ratios of the times that the program spends in different parts of the program. In order to make the best use of computational characteristics and resources in a distributed heterogeneous computing system, it is essential to reassign tasksdynamically during program execution, so asto take advantage of changes in the local reference patterns of the program. Dynamic algorithms are employed more frequently because they offer a better efficiency, having the flexibility of tasks migration. In addition, usually dynamic algorithms are neither very complicated to construct nor costly to run. Hence dynamic algorithms have the potential to outperform static algorithms in general. Clearly, the gains from relocating tasks must outweigh the cost of relocation. For this relocation, detailed information on a programβs activity over its lifetime can be collected at each time slot of lifetime. We use phase as the unit of the time slot for gathering more detailed information of program activity. Bokhari [10] analyzed the problem of dynamic assignment in a two-processor system, which permits relocation of tasks from one processor to the other at certain points during the execution of the program. This relocation incurs a predefined relocation cost that contributes to the total cost of running the program and code-conversion overheads. Also it is shown that an optimal dynamic assignment corresponds to a βdynamicβ partition imposed by a minimum weight cut in an extended graph. In this paper, we consider the dynamic task assignment problem for a general program structure and a heterogeneous -processors in DCS.

The rest of the paper is organized as follows. Definitions and assumptions are defined first in Section 2. In Section 3, tasks allocation problem has been discussed. The proposed method and algorithm have been explained in Sections 4 and 5 concludes this paper.

#### 2. Definitions and Assumptions

##### 2.1. Definitions

(i)Phase: a phase of a distributed program is a contiguous period of time during which only one task is executed. During this period, the executing task may communicate with any number of the remaining task. A task may not be moved from one processor to another during a phase; it may be moved only between them. A task may complete its execution in more than two phases; therefore, the number of phases of the executing program is always more than the number of the tasks.(ii)Execution cost: the execution cost is the amount of the work to be performed by the executing task on the processor during the th phase.(iii)Intertask communication cost: the intertask communication cost is incurred due to the data units exchanged between the executing task and residing task if they are on different processors during the process of execution in th phase.(iv)Residence cost: residence cost (where ) is the amount of time spent by the residing task (other than executing task) on the processor in th phase. These costs may come from the use of storage.(v)Relocation cost: relocation cost is the cost of reassigning the th task from one processor to another processor at the end of th phase.

##### 2.2. Assumptions

(i)The program to be executed is assumed to be collection of tasks that are free, in general, to reside on either of the processors. A task may be a module of executable program.(ii)The given program runs in various phases with one of its task executing on a processor in each phase and each of the other tasks residing on any of the processors.(iii)In each phase, execution cost (EC), residence cost (RC) of nonexecuting tasks, intertask communication cost (ITCC) of executing task with nonexecuting tasks, and relocation cost (REC) for reassigning each task from one processor to the others at the end of phases are known.(iv)Some of the tasks have restrictions for being allocated on some particular processor because of the nonavailability of desired facilities which may include access to particular peripheral device, access to a particular task, and high speed arithmetic capability of the processor. The execution costs of such tasks are taken to be infinite on those processors where these tasks can not be executed.

#### 3. Problem Statement

Consider a distributed program consisting of a set of tasks to be allocated to a set of processors divided into phases. The basis for dynamic program model is the concept of the phases of a task program.With each phase the following information is associated:

(1)the executing task during this phase and its execution cost on each processor in a heterogeneous system;(2)residence costs of the remaining tasks, except for the executing task, on each processor. These costs may come from the use of storages;(3)intertask communication cost between the executing task and all other tasks if they are on different processors;(4)an amount of relocation cost for reassigning each task from one processor to the others at the end of the phases. In general, the objective of task assignment is to minimize the completion cost of a distributed program by properly mapping the tasks to the processors. The cost of an assignment , , is the sum of execution, intertask communication, residence, and relocation costs, that is, In order to make the best use of the resources in a DCS, we would like to find an assignment having minimum cost.

#### 4. Proposed Method and Algorithm

The problem for allocating a program dynamically that
has been divided into number of phases is to determine the optimal task
allocation strategy by considering the phasewise EC for executing task and RC
for nonexecuting tasks during the phases. The phasewise processing efficiency
of individual processor is given in the form of matrix
of order and RC of each residing task is reflected through matrix of order . ITCC between executing task and
another tasks is taken
in the form of matrix of order .
The th column of this matrix represents the ITCC between the executing task
and all other residing tasks for the th phase. Relocation costs for
reassigning the tasks from one processor to another at the end of the phases is
shown by matrix of order where is the relocation cost for reassigning the th task from one processor to the
another at the end of th phase. In this paper, we have considered that the relocation cost is a constant when th task relocates from one processor to another at the end of the th phase.
The model starts from the first phase for allocating the tasks and moves to the
next phase. Let *t _{s}* be the th executing task
and be the th residing tasks during th phase. The execution
for the executing task

*t*and residing task to the processors in the th phase have been depicted in Figure 1.

_{s}The executing task (represented by^{*}) must
be assigned to processor during th phase for which sum of its
execution and relocation costs is minimum. This minimum cost for the task is represented by TEC_{k}. When residing task *t _{g}* resides on a processor, it has three-type costs, that is. residing, relocation,
and communication cost with the executing task . Therefore, the residing
task must be assigned to that processor

*p*where it has minimum costs mentioned above. This minimum cost for the task is represented by . Similarly, all other residing tasks are assigned to the processors. The total cost TRC

_{h}_{k}due to the residing tasks in the th phase will be: The total cost for the th phase is the sum of and , that is, The total optimal cost, TCOST, for the program will be as follows: Using the arrays representation for the execution, residing, intertask communication, and relocation costs, a mathematical model has been developed for allocating the distributed program dynamically which has been splitting into any number of tasks partition and completing their execution in any number of phases. The process of allocating the tasks to the processors is given in the form of Algorithm 1.

*Implementation of the Model**Example 1. *Consider
a program made up of four tasks to
be allocated on two processors in five phases.
Task completes its execution in two phases (in phase 1 and phase
5). The various matrices to be taken as input are described phasewise in Tables 1
and 2.

On applying the present tasks
allocation model, we get the following optimal assignment as follows:
The result of Example 1 is shown by Figure 2. Here circles labeled with tasks number represent tasks (tasks represented by^{*} are
executive task and others are residing tasks). Costs associated with tasks
are their execution costs (for tasks represented by^{*}) or residence costs. The edges connecting the executing task
with other residing tasks during the same phase represent the communication and
weights of these edges represent
communication costs between the executing task and other residing tasks.
The edges connecting the task of a phase to the task of the next phase
represent the relocation of the tasks and the weights of these edges represent
the costs of relocating the tasks. For example, the task is
relocating from processor to processor between the
phase 2 and phase 3. The above result shows that the assignments of the tasks
are changing phase to phase. Optimal
cost for this task program is 59.

*Example 2. *Consider a program made up of seven tasks to be
executed on three processors in
eight phases. The various matrices to be taken as input are described phasewise
in Tables 3 and 4.

The present tasks allocation model gives the following optimal assignment as follows:where The results of Example 2 are shown by Figure 3. Task completes its execution in two phases (in phase 1 and phase 7). The execution cost for the task is 2 in phase 1 and 4 in phase 7. The above result for the executing task shows that the assignments for both the phases are different, that is; it depends on the characteristic of the computation. The optimal cost for tasks program is 185.

#### 5. Conclusion

We have
presented an efficient solution technique for tasks execution dynamically in
DCS. Starting with the definitions of the phase of a modular program, we have
developed a mathematical-based assignment technique for allocating the tasks of
a program, divided into -phases to processors. The present model is compared
with Kumar et al. [11] and Bokhari [10].
Kumar et al. [11] have developed a mathematical model for
allocating ββ tasks of a program to ββ processors (), divided into any
number of phases. In this paper, authors have considered only execution, residence,
and intertask communication costs. It is also observed that the model [11] does
not work for the system program having relocation cost for reassigning
each task from one processor to the others at the end of phases. Bokhari
[10] has developed a
graph theoretical approach for finding out the optimal dynamic assignment of a
modular program for the two-processor system considering execution, residence,
intertask communication, and relocation costs. The model [10] can not find out
the solution when the system is NP-hard () while the present model
is applicable for the DCS having any number of phases and processors with
random program structure. The study of the time complexity of the present model
has also been made and compared with Bokhari [10] and Cho and Park [9]. For Bokhari
[10], the time complexity of the solution of the dynamic task assignment
problem for the two-processor system is O(M^{3}K^{3}). The time
complexity of the present tasks model for
any number of processors is
O(M^{2}N^{2}K) which is time-saving as compared to O(M^{2}N^{2}K^{2}log NMK) for the Cho and Park [9].

#### References

- S. H. Bokhari,
*Assignment Problem in Parallel and Distributed Computing*, Kluwer Academic Publishers, Boston, Mass, USA, 1987. - H. S. Stone, βMultiprocessor scheduling with the aid of network flow algorithms,β
*IEEE Transactions on Software Engineering*, vol. SE-3, no. 1, pp. 85β93, 1977. View at Publisher Β· View at Google Scholar - S. H. Bokhari, βA shortest tree algorithm for optimal assignments across space and time in a distributed processor system,β
*IEEE Transactions on Software Engineering*, vol. SE-7, no. 6, pp. 583β589, 1981. View at Publisher Β· View at Google Scholar - D. F. Towsley, βAllocating programs containing branches and loops within a multiple processor system,β
*IEEE Transactions on Software Engineering*, vol. SE-12, no. 10, pp. 1018β1024, 1986. View at Google Scholar - D. Fernandez-Baca, βAllocating modules to processors in a distributed system,β
*IEEE Transactions on Software Engineering*, vol. 15, no. 11, pp. 1427β1436, 1989. View at Publisher Β· View at Google Scholar - A. Ghafoor and J. Yang, βA distributed heterogeneous supercomputing management system,β
*Computer*, vol. 26, no. 6, pp. 78β86, 1993. View at Publisher Β· View at Google Scholar - M. P. Singh, P. K. Yadav, and H. Kumar, βA tasks allocation model for efficient utilization of processor's capacity in heterogeneous distributed systems,β in
*Proceeding of the 9th Conference of International Academy of Physical Sciences*, Agra, India, February 2007. - C.-H. Lee, D. Lee, and M. Kim, βOptimal task assignment in linear array networks,β
*IEEE Transactions on Computers*, vol. 41, no. 7, pp. 877β880, 1992. View at Publisher Β· View at Google Scholar - S.-Y. Cho and K. H. Park, βDynamic task assignment in heterogeneous linear array networks for metacomputing,β in
*Proceeding of the Heterogeneous Computing Workshop*, pp. 66β71, Cancun, Mexico, April 1994. View at Publisher Β· View at Google Scholar - S. H. Bokhari, βDual processor scheduling with dynamic reassignment,β
*IEEE Transactions on Software Engineering*, vol. SE-5, no. 4, pp. 341β349, 1979. View at Publisher Β· View at Google Scholar - V. Kumar, M. P. Singh, and P. K. Yadav, βAn efficient algorithm for multiprocessor scheduling with dynamic reassignment,β in
*Proceeding of the 6th National Seminar on Theoretical Computer Science*, pp. 105β118, Banasthali, Rajasthan, India, August 1996.