Assignments Across Time in Distributed Processor: Algorithm Optimal
Assignments Across Time in Distributed Processor: Algorithm Optimal
Assignments Across Time in Distributed Processor: Algorithm Optimal
Abstract-The problem of optimally assigning the modules of a pro- Research by Stone [51, [7] and Bokhari [1], [2] has shown
gram over the processors of an inhomogeneous distributed processor how the optimal assignment may be found efficiently for the
system is analyzed. The objective is to assign modules, wherever pos- case of dual processor systems using a network flow algorithm.
sible, to the processors on which they execute most rapidly while taking
into account the overhead of interprocessor communication. Factors While an extension to three processors was developed by Stone
contributing to the cost of an assignment are 1) the amount of compu- [6], algorithms for four or more processors have not been
tation required by each module, 2) the amount of data transmitted be- found. Gursky [3] has shown that the problem of finding the
tween each pair of modules, 3) the speed of each processor, and 4) the optimal assignment for four or more processors isNP-complete.
speed of the communication link between each pair of processors. In Section II of this paper we show that if the intermodule
A shortest tree algorithm is described that minimizes the sum of exe-
cution and communication costs for arbitrarily connected distributed
communication pattern of the program is constrained to be
systems with arbitrary numbers of processors, provided the intercon- a tree, then the problem may be solved for an arbitrary num-
nection pattern of the modules forms a tree. The algorithm uses a ber of processors using an efficient dynamic programming
dynamic programming approach to solve the problem for m modules approach. Programs that have a tree-like structure form an
and n processors in O(mn2) time. important class and include programs written as a hierarchy
It is shown that this algorithm may also be used to optimally schedule of subroutines. Turner [8] has discussed how a tree-like
a number of tasks whose precedence relationship forms a tree over a set
of processors whose costs of execution and intercommunication vary structure is best suited for large modular programs.
with time. The motivation in this case is to distribute the task over the The algorithm takes into account the interconnection struc-
processors, delaying the execution of tasks wherever deadlines permit ture of the distributed system (i.e., the speeds of links between
so as to take advantage of periods of light loading of specific processors pairs of processors) a consideration that does not arise in the
and communication links.
In this case the algorithm may be used to minimize the sum of execu- dual processor case.
tion costs (processor and time dependent), communication costs (de- The algorithm minimizes the sum of module execution and
pendent on the characteristics of specific links and on time), and the interprocessor communication costs. The two costs must be
penalties for not meeting deadlines (if any). expressed in the same units which could be time or dollars or
other resource units. If the costs are expressed in dollars, then
Index Terms-Computer networks, distributed processing, precedence
trees, program assignment, scheduling, shortest trees.
the algorithm will minimize the total financial cost of exe-
cuting the program. If expressed in terms of module execu-
tion and interprocessor communication time it will minimize
I. INTRODUCTION the total execution time assuming serial execution of the pro-
OVER the past few years interests in distributed process- gram. That is, even though there are several modules and
ing has led to the identification of several challenging processors, only one module is active on one processor at a
problems. One of these is the problem of optimally assigning time. This is the case in some distributed processing applica-
the modules of a modular program over the processors of an tions including the distributed processor at Brown University
inhomogeneous distributed processor system. Factors con- [4], [9] which has served as a model for prior research by
tributing to the cost of an assignment are 1) the amount of Stone and Bokhari.
computation required by each module, 2) the amount of data In Section III of this paper we show how the dynamic pro-
transmitted between each pair of modules, 3) the speed of gramming approach may also be used to optimally schedule
each processor, and 4) the speed of the communication link a number of tasks whose precedence relationship forms a tree
between each pair of processors. over a set of processors whose costs of execution and inter-
communication vary with time. The motivation in this case
Manuscript received July 5, 1979; revised January 14, 1981. This is to distribute the tasks over the processors, delaying their
work was supported by the National Science Foundation under Grant execution wherever deadlines permit so as to take advantage
MCS-76-11650 while the author was at the Department of Electrical of periods of light loading of specific processors and communi-
and Computer Engineering, University of Massachusetts, Amherst,
and by NASA under Contract NAS-1-14101 while the author was at cation links.
the Institute for Computer Applications in Science and Engineering In this case the algorithm may be used to minimize the sum
(ICASE), NASA Langley Research Center, Hampton, VA. of execution costs (processor and time dependent), communi-
The author is with the Department of Electrical Engineering, Univer-
sity of Engineering and Technology, Lahore, Pakistan. cation costs (dependent on the characteristics of specific links
cessor j is denoted ei1 and equals the sum of the costs of the rithm described below can easily be modified to handle this
various periods of execution of the module throughout the case (for which separate di's and d1i's will be required.)
lifetime of the program (since, for example, a subroutine is The cost of invoking a coresident module is assumed to be
typically executed several times during a program run). zero, i.e., Spp = 0. Should this assumption not be valid, it too
The eii's for an m module, n processor problem form an can be relaxed to account for nonnegligible intraprocessor
m X n matrix. Since the processors are dissimilar, the cost communication costs.
of executing a module varies from processor to processor, There is a nonzero di1 associated with each directed edge
that is, eij $ eik, in general. A module may be constrained from node i to node j in the invocation tree of our program.
to reside on a subset of available processors (perhaps on only
one processor) by making its execution costs on the comple- B. Minimum Cost Assignment Across Space
mentary subset infinite. We now show how the minimum cost assignment for our
Modules will transfer control to each other at various points modular program may be found. Such an assignment mini-
during the lifetime of the program. If we draw up a directed mizes the sum of execution costs and interprocessor communi-
graph in which each node represents a module and in which catibn costs.
there is an edge from node i to node / if and only if module Given the invocation tree of a modular program, and the
i calls module j during program execution, this would be a execution and interprocessor communication costs, we may
BOKHARI: SHORTEST TREE ALGORITHM FOR OPTIMAL ASSIGNMENTS 585
s
It follows from property 4) that to each assignment of the
m modules to the n processors there corresponds some subset
of nodes of the assignment graph. The subgraph generated
by these nodes plus the source and terminal nodes is called
an assignment tree and has the following properties.
1) It is a tree.
2) It connects the source node s to all terminal nodes
tl, t2,
3) It contains one and only one node from each layer of
the assignment graph.
There is a one to one correspondence between assignment
tl trees and module assignments. Furthermore, the weight of
each assignment tree (i.e., the sum of the weights of all edges
t3
in it) equals the cost of the corresponding assignment. This
follows from property 9) of assignment graphs. The thick
edges in Fig. 2 represent an assignment tree which is shoWn
in isolation in Fig. 3.
To find a minimum cost assignment we need to find the
t2 minimum weight assignment tree in the assignment graph.
Fig. 2. An assignment graph for the invocation tree of Fig. 1 and a This may be done using the dynamic programming approach
three-processor system. Thick edges form an assignment tree. Ovals described in the Appendix in O(mn2) time.
have been drawn around the two forksets.
III. DISTRIBUTION ACROSS SPACE AND TIME
draw up an assignment graph. Fig. 2 shows the assignment A. Motivations
graph for the invocation tree of Fig. 1 and a three-processor In this section we discuss how a set of tasks that must be
system. executed according to a tree-like precedence relationship may
The following definitions apply to this assignment graph. be optimally scheduled over a distributed processor system in
1) The assignment graph is a directed graph with weighted which costs vary with time.
edges. The computational resources of many organizations are in
2) There is one distinguished node called the source node, the form of a distributed computer network with each com-
denoted s. puter servicing one or more high priority local tasks and retain-
3) There are several terminal nodes tl, t2< one for each
, ing the capability of servicing remotely submitted tasks at a
leaf node of the invocation tree. low priority. In a production environment, the loads on the
4) In addition to the source and terminal nodes there are computers are fairly predictable as they depend heavily on
m X n further nodes in the assignment graph (for a problem the specific local loads on the machines.
involving m modules and n processors). Each node is labeled In such an environment we would be interested in distrib-
with a pair of numbers (i,j) and represents the assignment of uting a large set of tasks over the system such that it utilizes
module i to processor j. whatever processors are lightly loaded. Since the loads on the
5) Each layer of the assignment graph corresponds to a node processors are time dependent, we may wish to consider sus-
of the invocation tree. For example, the layer comprising pending some tasks until a time when the load on a particular
nodes (2, 1), (2, 2), and (2, 3) corresponds to node 2 of the processor is very light. Of course, some tasks may be time
invocation tree. critical and not admit any such suspension. Our problem thus
6) Nodes in layers corresponding to nodes in the invocation becornes one of distributing a set of tasks over a set of pro-
tree having outdegree greater than 1 are called forknodes. cessors, taking into account the run cost of each task on each
Each layer of forknodes is called a forkset. processor (which will, in general, be time-dependent), the
The edges have weights on them according to the following intercommunication costs between pairs of tasks (which will
rules. depend on the pairs of processors on which the two tasks are
7) All edges incident on the terminal nodes tl, t2, etc. have executed and may also be time dependent) and the penalties
zero weight on them. for not meeting deadlines for tasks (which may be set to in-
8) Edges joining sourcenode S to nodes (1, 1), (1, 2)," finity if a task must be executed by a certain time).
have weights el1, e12,* As a concrete example of a situation where such scheduling
9) The edge joining node (i, p) to node (j, q) has weight may be useful, consider the setting up of an appointment for
ejq Spq(djj). For example, the weight on the edge joining
+ a student to see a specific doctor at a University Infirmary.
node (1, 3) to (2, 1) is e2l +S13(dl2). This equals the cost This task is to be run at the University's central administrative
of assigning module 2 to processor 1, given that module 1 has computing center (which is made up of one or more time-
been assigned to processor 3. shared machines). The task involves the updating of a specific
586 IEEE TRANSACTIONS ON SOFTWARE ENGINEERING, VOL. SE-7, NO. 6, NOVEMBER 1981
at this center several CDC Cyber machines with varying com- a problem based on m modules, n processors, and k phases.
putational power but capable of executing essentially the same This is a weighted directed graph. (Fig. 5 omits the arrow
instruction set. Some powerful machines are completely dedi- heads on the edges for clarity-there is no ambiguity of direc-
BOKHARI: SHORTEST TREE ALGORITHM FOR OPTIMAL ASSIGNMENTS 587
SPACE
PROCESSOR 7
PROCESSOR 2
PROCESSOR 1
may be u'sed 1) optimally assign modular program that has layer-this takes 0(n2) time. This labeling is repeated k times.)
to a
588 IEEE TRANSACTIONS ON SOFTWARE ENGINEERING, VOL. SE-7, NO. 6, NOVEMBER 1981
2 3
Let us call this procedure SHORT and assume that it leaves remove f from FSET;
pointers from each node to the next node in the shortest path add tf to TSET;
to the terminal node.
We will call a forkset "exposed" when the shortest paths end;
from its nodes to all possible nodes have been found. end;
find the shortest path from the last terminal node to s;
begin
(* the length of this path equals the weight of the
input graph; shortest tree *)
(* TSET is the set of all terminal nodes *)
reconnect all disconnected edges;
(*FSET is the set of all forksets *) traverse graph from s to all terminal nodes by following
while ITSETI > 1 do pointers set up by procedure SHORT; (* each node
begin encountered is part of the shortest tree *)
to each terminal node t in TSET apply procedure end.
SHORT and remove t from TSET;
Fig. 6 shows an assignment graph just after the application of
for each exposed forkset f in FSET do procedure SHORT to terminal nodes t1 and t2. In Fig. 7 we
begin have temporarily removed the two limbs of the graph and
temporarily disconnect all outgoing edges; created a pseudoterminal node to. The weight on the edge
joining to to a node in the forkset equals the sum of the
create a pseudoterminal node tf; shortest paths from that node to tI and t2 from Fig. 6. After
join all nodes in f to tf with edges that finding the shortest path from s to to we reconnect the two
have weights equal to the sum of the limbs of the graph to obtain the shortest tree as shown in
several shortest paths to the several Fig. 8.
discarded terminal nodes; This algorithm is applicable to arbitrary assignment graphs.
..
ACKNOWLEDGMENT
The author wishes to thank Prof. H. Stone for his encourage-
ment of this research. Comments of the referees helped to
reshape this paper significantly.
REFERENCES
[1] S. H. Bokhari, "Dual processor scheduling with dynamic reassign-
ment," IEEE Trans. Software Eng., vol. SE-5, pp. 341-349, July
1979.
[2] -, "Optimal assignments in dual processor distributed systems
under varying load conditions," IEEE Trans. Software Eng., to
be published.
[3] M. Gursky, private communication.
[4] J. Michel and A. van Dam, "Experience with distributed processing
on a host/satellite graphics system, in Proc. SIGGRAPH '76; avail-
Fig. 6. Shortest paths from t, and t2 to ali the nodes in the forkset. able as Computer Graphics (SIGGRAPH Newsletter), vol. 10, no.
2, 1976.
[5] H. S. Stone, "Multiprocessor scheduling with the aid of network
flow algorithms," IEEE Trans. Software Eng., vol. SE-3, pp. 85-93,
Jan. 1977.
[6] -, "Program assignment in three-processor systems and tricutset
partitioning of graphs," Dep. Elec. Comput. Eng., Univ. Massa-
chusetts, Amherst, Tech. Rep. ECE-CS-77-7, 1977.
[7] -, "Critical load factors in distributed systems," IEEE Trans.
Software Eng., vol. SE-4, pp. 254-258, May 1978.
[8] J. Turner, "The structure of modular programs," Commun. Ass.
Comput. Mach., vol. 23, pp. 272-277, May 1980.
[9] A. van Dam, G. Stabler, and R. Harrington, "Intelligent satellites
for interactive graphics," Proc. IEEE, vol. 62, pp. 83-92, Apr.
1974.
Fig. 7. Transformed graph with shortest path from pseudoterminal
node to to s.
.. .. k7 _. ..
I
- .,