DISTRIBUTED SYSTEMS II A POLYNOMIAL LOCAL SOLUTION TO MUTUAL EXCLUSION Prof Philippas Tsigas...
-
Upload
giles-robertson -
Category
Documents
-
view
212 -
download
0
Transcript of DISTRIBUTED SYSTEMS II A POLYNOMIAL LOCAL SOLUTION TO MUTUAL EXCLUSION Prof Philippas Tsigas...
DISTRIBUTED SYSTEMS II A POLYNOMIAL LOCAL SOLUTION TO MUTUAL EXCLUSION
Prof Philippas TsigasDistributed Computing and Systems Research Group
Doorways
Doorway is a separation mechanism of two areas. Processes which pass a doorway at time T prevent
neighbor processes entering the same area at a greater time than T until exiting the doorway.
Asynchronous Doorway
Enry Code Exit Code
m1 is the “I am going in” message
Behavior
Problem with the Asynchronous Doorway
Synchronous Doorway
A process which desires to enter a synchronous doorway is required to wait for a situation in which all its neighbors are outside the doorway. This is implemented by checking for a process the states of its neighbors before it enters the doorway.
Synchronous Doorway
Entry code: Exit code:
What Can Go Wrong?
What if We Combine?
LINK REVERSAL ALGORITHMS
Based on slides from Jennifer Welch
12
What is Link Reversal?
Distributed algorithm design technique Used in solutions for a variety of problems
– routing, leader election, mutual exclusion, scheduling, resource allocation,…
Model problem as a directed graph and reverse the direction of links appropriately
Use local knowledge to decide which links to reverse
Routing [Gafni & Bertsekas 1981]
Undirected connected graph represents communication topology of a system
Unique destination node Assign virtual directions to the graph edges
(links) s.t.– if nodes forward messages over the links, they
reach the destination Directed version of the graph (orientation)
must– be acyclic– have destination as only sink
Thus every node has path to destination. 13
Routing Example
14
D
1 2 3
4 5 6
Mending Routes
What happens if some edges go away?– Might need to change the virtual directions on some
remaining edges (reverse some links)
More generally, starting with an arbitrary directed graph, each node should decide independently which of its incident links to reverse
15
Mending Routes Example
16
D
1 2 3
4 5 6
Sinks
A vertex with no outgoing links is a sink. The property of being a sink can be detected
locally. A sink can then reverse some incident links Basis of several algorithms…
17
Full Reversal Routing Algorithm
18
Input: directed graph G with destination vertex D
Let S(G) be set of sinks in G other than D while S(G) is nonempty do
– reverse every link incident on a vertex in S(G)– G now refers to resulting directed graph
19
Full Reversal (FR) Routing Example
D
1 2 3
4 5 6
D
1 2 3
4 5 6
D
1 2 3
4 5 6
D
1 2 3
4 5 6
D
1 2 3
4 5 6
D
1 2 3
4 5 6
Why Does FR Terminate?
Suppose it does not. Let W be vertices that take infinitely many steps. Let X be vertices that take finitely many steps;
includes D. Consider neighboring nodes w in W, x in X. Consider first step by w after last step by x: link is
w g x and stays that way forever. Then w cannot take any more steps, contradiction.
20
Why is FR Correct?
Assume input graph is acyclic. Acyclicity is preserved at each iteration:
– Any new cycle introduced must include a vertex that just took a step, but such a vertex is now a source (has no incoming links)
When FR terminates, no vertex, except possibly D, is a sink.
A DAG must have at least one sink:– if no sink, then a cycle can be constructed
Thus output graph is acyclic and D is the unique sink.
21
References Resource Allocation and Link Reversal
Dijkstra, E. W. (1971, June). Hierarchical ordering of sequential processes. Acta Informatica 1(2): 115-138.
Chandy, K.M.; Misra, J. (1984). The Drinking Philosophers Problem. ACM Transactions on Programming Languages and Systems.
Nancy A. Lynch. Upper bounds for static resource allocation in a distributed system Journal for Computer and System Sciences, 23:254-278, 1981
Manhoi Choy and Ambuj K. Singh. Efficient fault-tolerant algorithms for distributed resource allocation. ACM Transactions on Programming Languages and Systems, 17(3):535-559, May 1995.
Gafni and Bertsekas, “Distributed Algorithms for Generating Loop-Free Routes in Networks with Frequently Changing Topology,” IEEE Trans. Comm. 1981.
Welch and Walter, “Link Reversal Algorithms,” Synthesis Lectures on Distributed Computing Theory #8, Morgan & Claypool Publishers, 2012.
22