Comparison of Tarry’s Algorithm and Awerbuch’s Algorithm Mike Yuan CS 6/73201 Advanced Operating...

30
Comparison of Tarry’s Algorithm and Awerbuch’s Algorithm Mike Yuan CS 6/73201 Advanced Operating Systems Fall 2007 Dr. Nesterenko

Transcript of Comparison of Tarry’s Algorithm and Awerbuch’s Algorithm Mike Yuan CS 6/73201 Advanced Operating...

Page 1: Comparison of Tarry’s Algorithm and Awerbuch’s Algorithm Mike Yuan CS 6/73201 Advanced Operating Systems Fall 2007 Dr. Nesterenko.

Comparison of Tarry’s Algorithm and Awerbuch’s

Algorithm

Mike Yuan

CS 6/73201 Advanced Operating Systems Fall 2007

Dr. Nesterenko

Page 2: Comparison of Tarry’s Algorithm and Awerbuch’s Algorithm Mike Yuan CS 6/73201 Advanced Operating Systems Fall 2007 Dr. Nesterenko.

Outline Motivation Introduction Experiments Setup Results and Analysis Phenomenon Explanation Conclusion and Future Work Coding the Project References

Page 3: Comparison of Tarry’s Algorithm and Awerbuch’s Algorithm Mike Yuan CS 6/73201 Advanced Operating Systems Fall 2007 Dr. Nesterenko.

Motivation Time complexity of Awerbuch’s algorithm is

theoretically better than Tarry’s algorithm Message complexity of Tarry’s algorithm is

theoretically better than Awerbuch’s algorithm How do arbitrary topologies perform in

practice? In what scenarios does one algorithm perform

better than the other?

Page 4: Comparison of Tarry’s Algorithm and Awerbuch’s Algorithm Mike Yuan CS 6/73201 Advanced Operating Systems Fall 2007 Dr. Nesterenko.

Outline Motivation Introduction Experiments Setup Results and Analysis Phenomenon Explanation Conclusion and Future Work Coding the Project References

Page 5: Comparison of Tarry’s Algorithm and Awerbuch’s Algorithm Mike Yuan CS 6/73201 Advanced Operating Systems Fall 2007 Dr. Nesterenko.

Introduction Tarry’s Algorithm:

Initiator forwards the token to one of its neighbors, each neighbor forwards the token to all other nodes and when done returns the token.

Awerbuch’s Algorithm: A node holding the token for the first time informs all

neighbors except its father (and the node to which it will forward the token).

Prevents token forwarding over frond edges -each process knows which neighbors were visited before it forwards the token.

Measuring efficiency of algorithms: time complexity: the number of messages in the longest

chain of causally dependent events Message complexity: number of messages it takes the

algorithm to carry out specified task

Page 6: Comparison of Tarry’s Algorithm and Awerbuch’s Algorithm Mike Yuan CS 6/73201 Advanced Operating Systems Fall 2007 Dr. Nesterenko.

Outline Motivation Introduction Experiments Setup Results and Analysis Phenomenon Explanation Conclusion and Future Work Coding the Project References

Page 7: Comparison of Tarry’s Algorithm and Awerbuch’s Algorithm Mike Yuan CS 6/73201 Advanced Operating Systems Fall 2007 Dr. Nesterenko.

Experiments Setup

• Measure time and message complexities while varying size and density of network

• Graphs are usually random for these experiments

• Random graphs are represented by adjacency matrices

Adjacency matrix for the example graph:

1 2 3 4 5

1 0 1 1 0 0

2 1 0 1 1 0

3 1 1 0 1 1

4 0 1 1 0 1

5 0 0 1 1 0

1

3

2

4

5

1

3

2

4

5

Page 8: Comparison of Tarry’s Algorithm and Awerbuch’s Algorithm Mike Yuan CS 6/73201 Advanced Operating Systems Fall 2007 Dr. Nesterenko.

Density and scale of graphs

Connection probability: probability of there is an edge between node i and j is p, e.g, 30%, 50%, 70%

Connectivity: generated random graphs must be connected

– Sparse graph: connection probability= 30%– Moderate graph: connection probability= 50%– Dense graph: connection probability= 70% Increase the scale of the graphs

Page 9: Comparison of Tarry’s Algorithm and Awerbuch’s Algorithm Mike Yuan CS 6/73201 Advanced Operating Systems Fall 2007 Dr. Nesterenko.

Number of nodes: 3-50 and metrics considered

Two nodes are trivial, at least three nodes More accurate in range of 3 to 10 because

the two algorithms differentiate Difference is more and more pronounced

and stable in range 30-50 Time complexity Message complexity

Page 10: Comparison of Tarry’s Algorithm and Awerbuch’s Algorithm Mike Yuan CS 6/73201 Advanced Operating Systems Fall 2007 Dr. Nesterenko.

Outline Motivation Introduction Experiments Setup Results and Analysis Phenomenon Explanation Conclusion and Future Work Coding the Project References

Page 11: Comparison of Tarry’s Algorithm and Awerbuch’s Algorithm Mike Yuan CS 6/73201 Advanced Operating Systems Fall 2007 Dr. Nesterenko.

Time complexity of sparse graphs

Comparison of Time Complexity at Connection

Probability of 30%

0

200

400

600

800

0 20 40 60

Number of nodes in graph

Tim

e C

om

ple

xit

y

Tarry's algorithm

Awerbuch'salgorithm

Page 12: Comparison of Tarry’s Algorithm and Awerbuch’s Algorithm Mike Yuan CS 6/73201 Advanced Operating Systems Fall 2007 Dr. Nesterenko.

Analysis of time complexity of sparse graphs

Tarry’s algorithm is better than Awerbuch’s algorithm in range 3-9 nodes

Tarry’s algorithm’s complexity is almost same as Awerbuch’s algorithm’s complexity in range 10-11 nodes

Awerbuch’s algorithm is better than Tarry’s algorithm in range equal to or more than 12 nodes

The difference is more and more pronounced as scale of graphs increases

Awerbuch’s algorithm is more stable than Tarry’s algorithm

Page 13: Comparison of Tarry’s Algorithm and Awerbuch’s Algorithm Mike Yuan CS 6/73201 Advanced Operating Systems Fall 2007 Dr. Nesterenko.

Time complexity of moderate graphs

Comparison of Time Complexity at Connection

Probability of 50%

0200400600800

100012001400

0 20 40 60

Number of nodes in graph

Tim

e C

om

ple

xit

y

Tarry's algorithm

Awerbuch'salgorithm

Page 14: Comparison of Tarry’s Algorithm and Awerbuch’s Algorithm Mike Yuan CS 6/73201 Advanced Operating Systems Fall 2007 Dr. Nesterenko.

Analysis of time complexity of moderate graphs

Tarry’s algorithm is better than Awerbuch’s algorithm in range 3-7 nodes

Tarry’s algorithm’s complexity is almost same as Awerbuch’s algorithm’s complexity in range 7-8 nodes

Awerbuch’s algorithm is better than Tarry’s algorithm in range equal to or more than 9 nodes

The difference is more pronounced than sparse graphs

The difference is more and more pronounced as scale of graphs increases

Awerbuch’s algorithm is more stable than Tarry’s algorithm, and almost same as sparse graph

Page 15: Comparison of Tarry’s Algorithm and Awerbuch’s Algorithm Mike Yuan CS 6/73201 Advanced Operating Systems Fall 2007 Dr. Nesterenko.

Time complexity of dense graphs

Comparison of Time Complexity at Connection

Probability of 70%

0

500

1000

1500

2000

0 20 40 60

Number of nodes in graph

Tim

e C

om

ple

xit

y

Tarry's algorithm

Awerbuch'salgorithm

Page 16: Comparison of Tarry’s Algorithm and Awerbuch’s Algorithm Mike Yuan CS 6/73201 Advanced Operating Systems Fall 2007 Dr. Nesterenko.

Analysis of time complexity of dense graphs

Tarry’s algorithm is better than Awerbuch’s algorithm in range 3-4 nodes

Tarry’s algorithm’s complexity is almost same as Awerbuch’s algorithm’s complexity in range 4-5 nodes

Awerbuch’s algorithm is better than Tarry’s algorithm in range equal to or more than 6 nodes

The difference is most pronounced among the three graphs

The difference is more and more pronounced as scale of graphs increases

Awerbuch’s algorithm is more stable than Tarry’s algorithm, and almost same as sparse and moderate graphs

Page 17: Comparison of Tarry’s Algorithm and Awerbuch’s Algorithm Mike Yuan CS 6/73201 Advanced Operating Systems Fall 2007 Dr. Nesterenko.

Message complexity of sparse graphs

Comparison of Message Complexity at

Connection Probability of 30%

0

500

1000

1500

2000

0 20 40 60

Number of nodes in graph

Me

ss

ag

e C

om

ple

xit

y

Tarry's algorithm

Awerbuch'salgorithm

Page 18: Comparison of Tarry’s Algorithm and Awerbuch’s Algorithm Mike Yuan CS 6/73201 Advanced Operating Systems Fall 2007 Dr. Nesterenko.

Analysis of message complexity of sparse graphs

Tarry’s algorithm is always better than Awerbuch’s algorithm

The difference is not distinguishable in range 3 to 15 nodes

The difference is distinguishable in range more than 15 nodes

The difference is more and more pronounced as scale of graphs increases

Awerbuch’s algorithm increases almost twice speed of Tarry’s algorithm

Page 19: Comparison of Tarry’s Algorithm and Awerbuch’s Algorithm Mike Yuan CS 6/73201 Advanced Operating Systems Fall 2007 Dr. Nesterenko.

Message complexity of moderate graphs

Comparison of Message Complexity at

Connection Probability of 50%

0

500

1000

1500

2000

2500

3000

0 20 40 60

Number of nodes in graph

Me

ss

ag

e C

om

ple

xit

y

Tarry's algorithm

Awerbuch'salgorithm

Page 20: Comparison of Tarry’s Algorithm and Awerbuch’s Algorithm Mike Yuan CS 6/73201 Advanced Operating Systems Fall 2007 Dr. Nesterenko.

Analysis of message complexity of moderate graphs

Tarry’s algorithm is always better than Awerbuch’s algorithm

The difference is not distinguishable in range 3 to 10 nodes

The difference is distinguishable in range more than 10 nodes

The difference is more and more pronounced as scale of graphs increases

Both complexities increase faster than sparse graphs, and difference is more pronounced than sparse graphs

Awerbuch’s algorithm increases almost twice speed of Tarry’s algorithm

Page 21: Comparison of Tarry’s Algorithm and Awerbuch’s Algorithm Mike Yuan CS 6/73201 Advanced Operating Systems Fall 2007 Dr. Nesterenko.

Message complexity of dense graphs

Comparison of Message Complexity at

Connection Probability of 70%

0

1000

2000

3000

4000

0 20 40 60

Number of nodes in graph

Me

ss

ag

e C

om

ple

xit

y

Tarry's algorithm

Awerbuch'salgorithm

Page 22: Comparison of Tarry’s Algorithm and Awerbuch’s Algorithm Mike Yuan CS 6/73201 Advanced Operating Systems Fall 2007 Dr. Nesterenko.

Analysis of message complexity of dense graphs

Tarry’s algorithm is always better than Awerbuch’s algorithm

The difference is not distinguishable in range 3 to 7 nodes

The difference is distinguishable in range more than 8 nodes

The difference is more and more pronounced as scale of graphs increases

Both complexities increase the quickest and difference is the most pronounced among the three graphs

Awerbuch’s algorithm increases almost twice speed of Tarry’s algorithm

Page 23: Comparison of Tarry’s Algorithm and Awerbuch’s Algorithm Mike Yuan CS 6/73201 Advanced Operating Systems Fall 2007 Dr. Nesterenko.

Outline Motivation Introduction Experiments Setup Results and Analysis Phenomenon Explanation Conclusion and Future Work Coding the project References

Page 24: Comparison of Tarry’s Algorithm and Awerbuch’s Algorithm Mike Yuan CS 6/73201 Advanced Operating Systems Fall 2007 Dr. Nesterenko.

Explanation of phenomenon

Awerbuch’s algorithm’s time complexity is better than Tarry’s algorithm

Time complexity of Tarry’s algorithm: 2E (all processes have been visited and each channel has been used once in both directions)

Time complexity of Awerbuch’s algorithm: 4N-2 (token traverses N-1 edges twice and is delayed at every root node for two time units)

The denser the graph is, the more Tarry’s algorithm’s time complexity is, but Awerbuch’s algorithm is not influenced much.

Page 25: Comparison of Tarry’s Algorithm and Awerbuch’s Algorithm Mike Yuan CS 6/73201 Advanced Operating Systems Fall 2007 Dr. Nesterenko.

Explanation of phenomenon (cont)

Tarry’s algorithm’s message complexity is better than Awerbuch’s algorithm

Message complexity of Tarry’s algorithm: 2E (same as time complexity)

Message complexity of Awerbuch’s algorithm: 4E (<vis> and <ack> are sent along each frond edge twice, <vis> from father to son, <ack> - from son to father, <tok> - twice along each tree edge)

The denser the graph is, the more both Tarry’s algorithm’s and Awerbuch’s algorithms’ message complexities are

Page 26: Comparison of Tarry’s Algorithm and Awerbuch’s Algorithm Mike Yuan CS 6/73201 Advanced Operating Systems Fall 2007 Dr. Nesterenko.

Outline Motivation Introduction Experiments Setup Results and Analysis Phenomenon Explanation Conclusion and Future Work Coding the Project References

Page 27: Comparison of Tarry’s Algorithm and Awerbuch’s Algorithm Mike Yuan CS 6/73201 Advanced Operating Systems Fall 2007 Dr. Nesterenko.

Conclusion and Future Work Conclusion– Awerbuch’s algorithm is more effective than Tarry’s

algorithm in time complexity– Tarry’s algorithm is more effective than Awerbuch’s

algorithm in message complexity– Both time and message complexity of Tarry’s algorithm, and

message complexity of Awerbuch’s algorithm are sensitive to the density of graph, but time complexity of Awerbuch’s algorithm is not sensitive to the density of graph

Future work– Experiment on real distributed systems, e.g., TinyOS,

multihop networks, sensor networks, etc– Experiment on larger N– Explore influence of density of graphs on the algorithms

Page 28: Comparison of Tarry’s Algorithm and Awerbuch’s Algorithm Mike Yuan CS 6/73201 Advanced Operating Systems Fall 2007 Dr. Nesterenko.

Coding the Project Generate random graphs− Represented by adjacency matrix− Initialize connection probability conprob=30%,

50%, 70%, and the network size− a[i,j]=1 if conprob>a random number between

0 and 1− Write the result to “network.dat” Tarry and Awerbuch’s algorithms− Implementation was mostly successful Excel− Used to create graphics

Page 29: Comparison of Tarry’s Algorithm and Awerbuch’s Algorithm Mike Yuan CS 6/73201 Advanced Operating Systems Fall 2007 Dr. Nesterenko.

References

A. Baruch, "A New Distributed Depth-First-Search Algorithm", Information Processing Letters 20(1985) 147-150.

F. Kuhn, R. Wattenhofer, Y. Zhang, and A. Zollinger. Geometric ad-hoc routing: Of theory and practice. 22nd ACM Symposium on the Principles of Distributed Computing (PODC), July 2003.

M. Miyashita, M. Nesterenko "2FACE: Bi-Directional Face Traversal for Efficient Geometric Routing" technical report TR-KSU-CS-2006-06, Kent State University.

G. Tarry, “Le Problem Des Labyrinthes”, Nouvelles Annales de Mathematique 14 (1895).

G. Tel, Introduction to Distributed Algorithms (2000).

Page 30: Comparison of Tarry’s Algorithm and Awerbuch’s Algorithm Mike Yuan CS 6/73201 Advanced Operating Systems Fall 2007 Dr. Nesterenko.

References (cont) A. Vora and M. Nesterenko. Void traversal for guranteed

delivery in geometric routing. The 2nd IEEE International Conference on Mobile Ad-hoc and Sensor Systems (MASS 2005), pages 63–67, November 2005.

D. Watson, M. Nesterenko "MULE: Hybrid Simulator for Testing and Debugging Wireless Sensor Networks" Second International Workshop on Sensor and Actor Network Protocols and Applications, pp. 67-71, Boston, Massachusetts, August 2004.

Slides of advanced operating systems class, http://deneb.cs.kent.edu/~mikhail/classes/aos.f07/.

TOSSIM User Manual, http://deneb.cs.kent.edu/~mikhail/classes/aos.f06/aos_tos_tutorial/tos_tutorial.html,2006.

TinyOs mailing Archive, http://deneb.cs.kent.edu/~mikhail/classes/aos.f06/aos_tos_tutorial/tos_tutorial.html.