Title: CSC7103 Advanced Operating Systems Louisiana State University Rajgopal Kannan
1 Distributed Process Scheduling
CSC7103 Advanced Operating Systems
Louisiana State University
Rajgopal Kannan
2 Issues in Distributed Scheduling
- The effect of communication overhead
- The effect of underlying architecture
- Dynamic behavior of the system
- Resource utilization
- Turnaround time
- Location and performance transparency
- Task and data migration
CSC7103 Advanced Operating Systems
Louisiana State University
Rajgopal Kannan
3 Classification of Distributed Scheduling
Algorithms
- Static or off-line
- Dynamic or on-line
- Real-time
CSC7103 Advanced Operating Systems
Louisiana State University
Rajgopal Kannan
4 Process or Load Modelling
- Precedence graph
- Communication graph
- Disjoint process model
- Statistical load modeling
CSC7103 Advanced Operating Systems
Louisiana State University
Rajgopal Kannan
5 System Modelling
- Communication system model
- Processor pool model
- Isolated workstation model
- Migration workstation model
CSC7103 Advanced Operating Systems
Louisiana State University
Rajgopal Kannan
6 Optimizing Criteria
- Speedup
- Resource utilization
- Makespan or completion time
- Load sharing and load balancing
CSC7103 Advanced Operating Systems
Louisiana State University
Rajgopal Kannan
7 Static Scheduling
Statistical load, isolated workstation
l
m
Turnaround time1/(m-l)
l
m
CSC7103 Advanced Operating Systems
Louisiana State University
Rajgopal Kannan
8 Static Scheduling
Statistical load, processor pool
m
2l
m
Turnaround timem/((m-l)(ml))
CSC7103 Advanced Operating Systems
Louisiana State University
Rajgopal Kannan
9 Static Scheduling
Communication process model, communication system
model
The general problem is NP-complete.
- Stones algorithm (2 heterogeneous processors,
arbitrary communication process graph). - Bokharis algorithm (n homogeneous processors,
linear communication process graph, linear
communication system)
CSC7103 Advanced Operating Systems
Louisiana State University
Rajgopal Kannan
10 Stone's Algorithm
Assumptions
- Two heterogeneous processors. Therefore, the
execution cost of each process depends on the
processor. Further, the execution cost for each
process is known for both processors. - Communication cost between each pair of processes
is known. - Interprocess communication incurs negligible cost
if both the processes are in the same processor.
CSC7103 Advanced Operating Systems
Louisiana State University
Rajgopal Kannan
11 Stone's Algorithm
Objective Function
Stones Algorithm minimizes the total execution
and communication cost by properly allocating the
processors among the processes.
Let, G(V,E) be the communication process model.
Let A and B be two processors. Let wA(u) and
wB(u) be the cost of executing process u on
processors A and B respectively. Let, c(u,v) be
the cost of interprocess communication between
processes u and v if they are allocated different
processors. Further, S be the set of processes to
be executed on processor A and V-S be the set of
process to be executed on processor B. Stones
algorithm computes S such that the objective
function Su e S wA(u)Sv e V-S wB(v)Su e S, v e
V-S c(u,v) is minimized.
CSC7103 Advanced Operating Systems
Louisiana State University
Rajgopal Kannan
12 Stone's Algorithm
Example
Computation Costs
Communication Costs
If process 1 and 2 are allocated to processor A,
and the rest in processor B, then the total cost
is 3143501219.
CSC7103 Advanced Operating Systems
Louisiana State University
Rajgopal Kannan
13 Stone's Algorithm
Commodity-flow problem
Stones algorithm reduces the scheduling problem
to the commodity-flow problem described below.
Let G(V,E) be a graph with two special nodes u
(source) and v (sink). Each edge has a maximum
capacity to carry some commodity. What is the
maximum amount of the commodity that can be
carried from the source to the sink.
- There is a known polynomial time algorithm to
solve the commodity-flow problem - Let S be a subset of V such that the source is
in S and the sink is in V-S. A set of edges (say
C) with one end in S and the other end in V-S is
called a cut and the sum of the capacities of the
edges in C is called the weight of the cut. It
can be shown that the maximum-flow is equal to
the minimum possible cut-weight. This is called
max-flow, min-cut theorem.
CSC7103 Advanced Operating Systems
Louisiana State University
Rajgopal Kannan
14 Stone's Algorithm
Reduction to the commodity-flow problem
Stones algorithm reduces the scheduling problem
to the commodity-flow problem as follows.
Let G(V,E) be the communication process graph.
Construct a new graph G(V,E) by adding two
new nodes a (source, corresponding to processor
A) and b (sink, corresponding to processor B).
For every node u in G, add the edges (a,u) and
(b,u) in G. The weights (capacities) of the new
edges will be wB(u) and wA(u) respectively.
- Note that a cut in G gives a processor
allocation for the job. - Further, the weight of the cut is same as the
cost (objective function) of execution cost of
communication for the processor allocation given
by the cut. - Therefore, if we compute the max-flow on G, the
corresponding min-cut gives the best processor
allocation.
CSC7103 Advanced Operating Systems
Louisiana State University
Rajgopal Kannan
15 Stone's Algorithm
5
Example
3
2
1
4
1
2
2
1
B
A
5
4
3
2
2
4
3
3
CSC7103 Advanced Operating Systems
Louisiana State University
Rajgopal Kannan
16 Bokhari's Algorithm
Assumptions
- n homogeneous processors, connected in a linear
topology. - kgtn processes, linear communication graph.
- Communication links are homogeneous.
- Computation and communication costs are known.
- Two processes not communicating directly will not
be allocated the same processor. - Two communicating processes, if not allocated
same processor, must be in the adajacent
processors.
CSC7103 Advanced Operating Systems
Louisiana State University
Rajgopal Kannan
17 Bokhari's Algorithm
Objective function
Bokharis algorithm minimizes the sum of the
total communication cost and the maximum
execution cost in a processor. Note the
difference with the objective function in Stones
algorithm.
Let P1,,Pn be processors in linear order and
p1,,pk be processes in linear order. Let the
execution cost of pi be wi and the communication
cost between pi and pi1 be ci. If processes
pj(j) to pi(j1)-1 be allocated to processor Pi,
then the objective function for Bokharis
algorithm will be maxiWjSi1ncj(i) where Wj is
the execution cost for processor j.
Wjwi(j)wj(i1)-1.
CSC7103 Advanced Operating Systems
Louisiana State University
Rajgopal Kannan
18 Bokhari's Algorithm
Example
2
4
2
1
3
3
2
4
1
2
1
P1
P2
P3
The value of the objective function
max(32,4,121)(21)8.
CSC7103 Advanced Operating Systems
Louisiana State University
Rajgopal Kannan
19 Bokhari's Algorithm
To solve the problem Bokhari constructed the a
layered graph. The graph has n2 layers, where n
is the number of processors. The top and bottom
layer has 1 node each. All other layers have k
nodes where k is the number of processes. We
number the layers from 0 thru k1 and denote the
ith node of jth layer by v(i,j). The node in the
top (0th) layer is adjacent to all nodes in layer
1. The node in the bottom layer is adjacent to
all nodes in the kth layer. Other v(i,j)s are
adjacent to v(i,j1),,v(k,j1).
Example of a layered graph constructed for n2
and k3. Note that any path from the top layer to
the bottom layer gives a processor allocation
subject to the restrictions described earlier and
vice versa.
CSC7103 Advanced Operating Systems
Louisiana State University
Rajgopal Kannan
20 Bokhari's Algorithm
Each edge e in the graph has two weights, w1(e)
and w2(e). If e is an edge connecting v(i,j) and
v(r,j1) then w1(e) is the total execution time
of the processes pi to pr-1 and w2(e) is the
communication cost between pr-1 and pr. Note
that, a shortest path from the top to bottom on
the basis of w2 will minimize the total
communication cost. Any known shortest path
algorithm may be used to do that. Further, w1 may
take only certain values. To be precise, there
are k1C2 possible values of w1. We can compute
those values and sort them. Then we can restrict
the w1 by deleting all edges with w1(e) greater
than the restricted value. A shortest path in the
new layered graph will minimize the total
communication cost subject to the restriction
that the maximum of the execution cost in any
processor will not exceed the threshold value.
Using this method we can compute the objective
function for each of the possible k1C2 threshold
values. The best processor allocation can thus be
computed. Note that a clever binary search over
the possible values of w1 may reduce the
computational complexity of the algorithm
significantly.
CSC7103 Advanced Operating Systems
Louisiana State University
Rajgopal Kannan
21 Dynamic Scheduling
The Goal of dynamic scheduling is to load share
and balance dynamically. This goal is achieved by
migrating tasks from heavily loaded processors to
lightly loaded processors.
- Two types of task migration algorithms
- Sender-initiated
- - Transfer policy (when to transfer?)
- - Selection policy (which task to transfer?)
- - Location policy (where to transfer?)
- Potentially unstable.
- Receiver-initiated
CSC7103 Advanced Operating Systems
Louisiana State University
Rajgopal Kannan
22 Real-time Scheduling
Real-time Scheduling
Definitions
A real-time task consists of Si, the earliest
start time, Di, the deadline to finish the task
and Ci, the worst-case completion time.
A set of real-time tasks is called a real-time
task set or a real-time system.
A system of real-time tasks is called hard
real-time system if all of the tasks in the
system must complete execution within their
respective deadlines. Even if one task misses its
deadline, the whole system is considered
incorrectly executed.
A system of real-time tasks is called soft
real-time system if the performance is judged by
how many tasks missed deadline and by how much.
CSC7103 Advanced Operating Systems
Louisiana State University
Rajgopal Kannan
23 Real-time Scheduling
Real-time Scheduling
Definitions
A schedule for a real-time system is a CPU
assignment to the tasks of the system such that a
CPU is assigned to no more than one task at one
time.
A schedule for a real-time system is called valid
if no task is assigned CPU before its
earliest-start time and all tasks complete
execution within their respective deadlines.
A real-time system is called feasible if there is
a valid schedule for the system.
CSC7103 Advanced Operating Systems
Louisiana State University
Rajgopal Kannan