1 concurrent counting is harder than queuing costas busch rensselaer polytechnic intitute srikanta...

81
1 Concurrent Counting is harder than Queuing Costas Busch Rensselaer Polytechnic Intitute Srikanta Tirthapura Iowa State University

Upload: adam-potter

Post on 19-Jan-2018

216 views

Category:

Documents


0 download

DESCRIPTION

3 Distributed Counting Some processors request a counter value count

TRANSCRIPT

Page 1: 1 Concurrent Counting is harder than Queuing Costas Busch Rensselaer Polytechnic Intitute Srikanta Tirthapura…

1

Concurrent Counting is harder than Queuing

Costas BuschRensselaer Polytechnic Intitute

Srikanta TirthapuraIowa State University

Page 2: 1 Concurrent Counting is harder than Queuing Costas Busch Rensselaer Polytechnic Intitute Srikanta Tirthapura…

2

Arbitrary graph

Page 3: 1 Concurrent Counting is harder than Queuing Costas Busch Rensselaer Polytechnic Intitute Srikanta Tirthapura…

3

Distributed Counting

Some processors request a counter value

count

count

count

count

Page 4: 1 Concurrent Counting is harder than Queuing Costas Busch Rensselaer Polytechnic Intitute Srikanta Tirthapura…

4

Distributed Counting

Final state

2

1

34

Page 5: 1 Concurrent Counting is harder than Queuing Costas Busch Rensselaer Polytechnic Intitute Srikanta Tirthapura…

5

Distributed Queuing

Some processors perform enqueue operations

Enq(A) Enq(B)

Enq(D)

Enq(C)A B

C

D

Page 6: 1 Concurrent Counting is harder than Queuing Costas Busch Rensselaer Polytechnic Intitute Srikanta Tirthapura…

6

Distributed Queuing

A B

C

D

headTail

A BC D

Previous=nil

Previous=B

Previous=D

Previous=A

Page 7: 1 Concurrent Counting is harder than Queuing Costas Busch Rensselaer Polytechnic Intitute Srikanta Tirthapura…

7

Counting: - parallel scientific applications - load balancing (counting networks)

Queuing:- distributed directories for mobile

objects- distributed mutual exclusion

Applications

Page 8: 1 Concurrent Counting is harder than Queuing Costas Busch Rensselaer Polytechnic Intitute Srikanta Tirthapura…

8

Multicast with the condition:all messages received at all nodes in the same order

Either Queuing or Counting will do

Which is more efficient?

Ordered Multicast

Page 9: 1 Concurrent Counting is harder than Queuing Costas Busch Rensselaer Polytechnic Intitute Srikanta Tirthapura…

9

Queuing vs Counting?

Total ordersQueuing = finding predecessorNeeds local knowledge

Counting = finding rankNeeds global knowledge

Page 10: 1 Concurrent Counting is harder than Queuing Costas Busch Rensselaer Polytechnic Intitute Srikanta Tirthapura…

10

ProblemIs there a formal sense in which Counting

is harder problem than Queuing?

Reductions don’t seem to help

Page 11: 1 Concurrent Counting is harder than Queuing Costas Busch Rensselaer Polytechnic Intitute Srikanta Tirthapura…

11

Our Result Concurrent Counting is harder than

Concurrent Queuing

on a variety of graphs including: many common interconnection topologies complete graph, mesh hypercube perfect binary trees

Page 12: 1 Concurrent Counting is harder than Queuing Costas Busch Rensselaer Polytechnic Intitute Srikanta Tirthapura…

12

Model

Synchronous system G=(V,E) - edges of unit delay

Congestion: Each node can process only one message in a single time step

Concurrent one-shot scenario:a set R subset V of nodes issue queuing (or

counting) operations at time zeroNo more operations added later

Page 13: 1 Concurrent Counting is harder than Queuing Costas Busch Rensselaer Polytechnic Intitute Srikanta Tirthapura…

13

Cost Model : delay till v gets back queuing result

Cost of algorithm A on request set R is

Queuing Complexity =

Define Counting Complexity Similarly

)(vCQ

Rv

QQ vCRAC )(),(

)},({maxmin RACQVRA

Page 14: 1 Concurrent Counting is harder than Queuing Costas Busch Rensselaer Polytechnic Intitute Srikanta Tirthapura…

14

Lower Bounds on Counting

Counting Cost = )log( * nn

For arbitrary graphs:

For graphs with diameter :D)( 2DCounting Cost =

Page 15: 1 Concurrent Counting is harder than Queuing Costas Busch Rensselaer Polytechnic Intitute Srikanta Tirthapura…

15

Theorem:

Proof:

Consider some arbitrary algorithmfor counting

For graphs with diameter :D)( 2DCounting Cost =

Page 16: 1 Concurrent Counting is harder than Queuing Costas Busch Rensselaer Polytechnic Intitute Srikanta Tirthapura…

16

Take shortest path of length

Graph

D

Page 17: 1 Concurrent Counting is harder than Queuing Costas Busch Rensselaer Polytechnic Intitute Srikanta Tirthapura…

17

Graph

make these nodes to count

12 3 4567 8

Page 18: 1 Concurrent Counting is harder than Queuing Costas Busch Rensselaer Polytechnic Intitute Srikanta Tirthapura…

18

k

Node of count decides after at least time steps

k

21k

Needs to be aware of other processors k-1

21k

21k

Page 19: 1 Concurrent Counting is harder than Queuing Costas Busch Rensselaer Polytechnic Intitute Srikanta Tirthapura…

19

Counting Cost: )(21 2

1DkD

k

End of Proof

Page 20: 1 Concurrent Counting is harder than Queuing Costas Busch Rensselaer Polytechnic Intitute Srikanta Tirthapura…

20

Theorem:

Counting Cost = )log( * nnFor arbitrary graphs:

Proof:

Consider some arbitrary algorithmfor counting

Page 21: 1 Concurrent Counting is harder than Queuing Costas Busch Rensselaer Polytechnic Intitute Srikanta Tirthapura…

21

Prove it for a complete graph with nodes:any algorithm on any graph with nodes can be simulated on the complete graph

nn

Page 22: 1 Concurrent Counting is harder than Queuing Costas Busch Rensselaer Polytechnic Intitute Srikanta Tirthapura…

22

The initial state affects the outcomeRed: countBlue: don’t count

v

Initial State

Page 23: 1 Concurrent Counting is harder than Queuing Costas Busch Rensselaer Polytechnic Intitute Srikanta Tirthapura…

23

Final state

Red: count

v

1

23

4

5

Blue: don’t count

Page 24: 1 Concurrent Counting is harder than Queuing Costas Busch Rensselaer Polytechnic Intitute Srikanta Tirthapura…

24

Initial state

Red: count

v

Blue: don’t count

Page 25: 1 Concurrent Counting is harder than Queuing Costas Busch Rensselaer Polytechnic Intitute Srikanta Tirthapura…

25

Final state

Red: count

v

1

23

45

6 78

Blue: don’t count

Page 26: 1 Concurrent Counting is harder than Queuing Costas Busch Rensselaer Polytechnic Intitute Srikanta Tirthapura…

26

v

Let be the set of nodes whose input may affect the decision of

)(vAv

)(vA

Page 27: 1 Concurrent Counting is harder than Queuing Costas Busch Rensselaer Polytechnic Intitute Srikanta Tirthapura…

27

Suppose that there is an initial statefor which decides v k

kvA |)(|Then:

v

)(vA

k

Page 28: 1 Concurrent Counting is harder than Queuing Costas Busch Rensselaer Polytechnic Intitute Srikanta Tirthapura…

28

v

)(vA

k

v

)(vA

k

These two initial states give same result forv

Page 29: 1 Concurrent Counting is harder than Queuing Costas Busch Rensselaer Polytechnic Intitute Srikanta Tirthapura…

29

v

)(vA

k

If , then would decide less than

kvA |)(|k

Thus, kvA |)(|

v

Page 30: 1 Concurrent Counting is harder than Queuing Costas Busch Rensselaer Polytechnic Intitute Srikanta Tirthapura…

30

Suppose that decides at timetv

We show:

22|)(| vA

22 t times

Page 31: 1 Concurrent Counting is harder than Queuing Costas Busch Rensselaer Polytechnic Intitute Srikanta Tirthapura…

31

Suppose that decides at timetv

kvA |)(|

22|)(| vA

22 t

timeskt *log

Page 32: 1 Concurrent Counting is harder than Queuing Costas Busch Rensselaer Polytechnic Intitute Srikanta Tirthapura…

32

kt *log

)log(log *

1

* nnkn

k

Cost of node : v

If nodes wish to count:n

Counting Cost =

Page 33: 1 Concurrent Counting is harder than Queuing Costas Busch Rensselaer Polytechnic Intitute Srikanta Tirthapura…

33

v

),( tvA

Nodes that affectup to time

vt

v

),( tvB

Nodes that affectsup to timev

t

|),(|max)( txAta x |),(|max)( txBtb x

Page 34: 1 Concurrent Counting is harder than Queuing Costas Busch Rensselaer Polytechnic Intitute Srikanta Tirthapura…

34

v

)1,( tvA

v

)1,( tvB

After , the sets grow1t

1)( ta 1)( tb

Page 35: 1 Concurrent Counting is harder than Queuing Costas Busch Rensselaer Polytechnic Intitute Srikanta Tirthapura…

35

),( tvA

v

)1,( tvA

Page 36: 1 Concurrent Counting is harder than Queuing Costas Busch Rensselaer Polytechnic Intitute Srikanta Tirthapura…

36

),( tvAv

)1,( tvA

),( tzA

Eligible to send messageat time

z

1t

There is an initial state such thatthat sends a message to z v

Page 37: 1 Concurrent Counting is harder than Queuing Costas Busch Rensselaer Polytechnic Intitute Srikanta Tirthapura…

37

),( tvAv

),( tzAz

)1,( tvA

),( tsAs

),(),( tzAtsA

Eligible to send messageat time 1t

Suppose thatThen, there is an initial state such that both send message tov

Page 38: 1 Concurrent Counting is harder than Queuing Costas Busch Rensselaer Polytechnic Intitute Srikanta Tirthapura…

38

),( tvAv

),( tzAz

)1,( tvA

),( tsAs

Eligible to send messageat time 1t

However, can receive one message at a time v

Page 39: 1 Concurrent Counting is harder than Queuing Costas Busch Rensselaer Polytechnic Intitute Srikanta Tirthapura…

39

),( tvAv

),( tzAz

)1,( tvA

),( tsAs

Eligible to send messageat time 1t

),(),( tzAtsATherefore:

Page 40: 1 Concurrent Counting is harder than Queuing Costas Busch Rensselaer Polytechnic Intitute Srikanta Tirthapura…

40

),( tzAz

),( tsAs

Number of nodes like : s )()( tbta

|),(|max txAx |),(|max txBx

Page 41: 1 Concurrent Counting is harder than Queuing Costas Busch Rensselaer Polytechnic Intitute Srikanta Tirthapura…

41

),( tvAv

),( tzAz

)1,( tvA

),( tsAs

Therefore: )()()(),()1,( tbtatatvAtvA

Page 42: 1 Concurrent Counting is harder than Queuing Costas Busch Rensselaer Polytechnic Intitute Srikanta Tirthapura…

42

)()(1)()1( tbtatata

We can also show: )(21)()1( tatbtb

Thus:

Which give:22)( a

22

times

End of Proof

Page 43: 1 Concurrent Counting is harder than Queuing Costas Busch Rensselaer Polytechnic Intitute Srikanta Tirthapura…

43

Upper Bound on Queuing

)log( nnOQueuing Cost =

For graphs with spanning trees of constant degree:

)(nOQueuing Cost =

For graphs whose spanning trees are lists or perfect binary trees:

Page 44: 1 Concurrent Counting is harder than Queuing Costas Busch Rensselaer Polytechnic Intitute Srikanta Tirthapura…

44

An arbitrary graph

Page 45: 1 Concurrent Counting is harder than Queuing Costas Busch Rensselaer Polytechnic Intitute Srikanta Tirthapura…

45

Spanning tree

Page 46: 1 Concurrent Counting is harder than Queuing Costas Busch Rensselaer Polytechnic Intitute Srikanta Tirthapura…

46

Spanning tree

Page 47: 1 Concurrent Counting is harder than Queuing Costas Busch Rensselaer Polytechnic Intitute Srikanta Tirthapura…

47

A

A

Distributed Queue

HeadTailTail

Previous = Nil

Page 48: 1 Concurrent Counting is harder than Queuing Costas Busch Rensselaer Polytechnic Intitute Srikanta Tirthapura…

48

A

B enq(B)

Tail AHeadTail

Previous = ?

Previous = Nil

Page 49: 1 Concurrent Counting is harder than Queuing Costas Busch Rensselaer Polytechnic Intitute Srikanta Tirthapura…

49

A

B

enq(B)

Tail AHeadTail

Previous = ?

Previous = Nil

Page 50: 1 Concurrent Counting is harder than Queuing Costas Busch Rensselaer Polytechnic Intitute Srikanta Tirthapura…

50

A

B

enq(B)

Tail AHeadTail

Previous = ?

Previous = Nil

Page 51: 1 Concurrent Counting is harder than Queuing Costas Busch Rensselaer Polytechnic Intitute Srikanta Tirthapura…

51

A

B

enq(B)

Tail AHeadTail

Previous = ?

Previous = Nil

Page 52: 1 Concurrent Counting is harder than Queuing Costas Busch Rensselaer Polytechnic Intitute Srikanta Tirthapura…

52

A

B

enq(B)

Tail AHeadTail

Previous = ?

Previous = Nil

Page 53: 1 Concurrent Counting is harder than Queuing Costas Busch Rensselaer Polytechnic Intitute Srikanta Tirthapura…

53

A

A

B

Tail

Previous = A

BA informs BHeadTail

Previous = Nil

Page 54: 1 Concurrent Counting is harder than Queuing Costas Busch Rensselaer Polytechnic Intitute Srikanta Tirthapura…

54

A

Concurrent Enqueue Requests

Tail

BC

AHeadTail

enq(B)enq(C)Previous = ? Previous = ?

Previous = Nil

Page 55: 1 Concurrent Counting is harder than Queuing Costas Busch Rensselaer Polytechnic Intitute Srikanta Tirthapura…

55

A

Tail

BC

AHeadTail

enq(B)enq(C)Previous = ? Previous = ?

Previous = Nil

Page 56: 1 Concurrent Counting is harder than Queuing Costas Busch Rensselaer Polytechnic Intitute Srikanta Tirthapura…

56

A

Tail

BC

AHeadTail

enq(B)

enq(C)

Previous = ? Previous = ?

Previous = Nil

Page 57: 1 Concurrent Counting is harder than Queuing Costas Busch Rensselaer Polytechnic Intitute Srikanta Tirthapura…

57

A

Tail

BC

enq(B)

ACHeadTail

Previous = A Previous = ?

Previous = Nil

Page 58: 1 Concurrent Counting is harder than Queuing Costas Busch Rensselaer Polytechnic Intitute Srikanta Tirthapura…

58

A

Tail

BCenq(B)

ACHeadTail

Previous = A Previous = ?

Previous = Nil

Page 59: 1 Concurrent Counting is harder than Queuing Costas Busch Rensselaer Polytechnic Intitute Srikanta Tirthapura…

59

A

Tail

BC

ACHeadTail

C informs B

Previous = CPrevious = A

B

Previous = Nil

Page 60: 1 Concurrent Counting is harder than Queuing Costas Busch Rensselaer Polytechnic Intitute Srikanta Tirthapura…

60

A

Tail

BC

ACHeadTail

Previous = CPrevious = A

B

Previous = Nil

Page 61: 1 Concurrent Counting is harder than Queuing Costas Busch Rensselaer Polytechnic Intitute Srikanta Tirthapura…

61

A

Tail

BC

ACHeadTail

Previous = CPrevious = A

B

Previous = Nil

Paths of enqueue requests

Page 62: 1 Concurrent Counting is harder than Queuing Costas Busch Rensselaer Polytechnic Intitute Srikanta Tirthapura…

62

Nearest-Neighbor TSP tour on Spanning tree

A

C B

D

Origin(first element in queue)

E F

Page 63: 1 Concurrent Counting is harder than Queuing Costas Busch Rensselaer Polytechnic Intitute Srikanta Tirthapura…

63

A

C B

Visit closest unused node in Tree

ED F

Page 64: 1 Concurrent Counting is harder than Queuing Costas Busch Rensselaer Polytechnic Intitute Srikanta Tirthapura…

64

A

C B

Visit closest unused node in Tree

ED F

Page 65: 1 Concurrent Counting is harder than Queuing Costas Busch Rensselaer Polytechnic Intitute Srikanta Tirthapura…

65

A

C B

ED F

Nearest-Neighbor TSP tour

Page 66: 1 Concurrent Counting is harder than Queuing Costas Busch Rensselaer Polytechnic Intitute Srikanta Tirthapura…

66

Queuing Cost 2 x Nearest-Neighbor TSP length

[Herlihy, Tirthapura, Wattenhofer PODC’01]

For spanning tree of constant degree:

Page 67: 1 Concurrent Counting is harder than Queuing Costas Busch Rensselaer Polytechnic Intitute Srikanta Tirthapura…

67

Nearest-NeighborTSP length Optimal

TSP length

[Rosenkratz, Stearns, Lewis SICOMP1977]

If a weighted graph satisfies triangular inequality:

nlogx

Page 68: 1 Concurrent Counting is harder than Queuing Costas Busch Rensselaer Polytechnic Intitute Srikanta Tirthapura…

68

A

C

D

B

E F

A

C

D

B

F2

4

41

3

1 2

31

weighted graph of distances

E1

23 4

21

Page 69: 1 Concurrent Counting is harder than Queuing Costas Busch Rensselaer Polytechnic Intitute Srikanta Tirthapura…

69

Satisfies triangular inequality

A

C

D21

11e

2e3e )()()( 321 ewewew

A

C

D

B

F2

4

41

3

1 2

31

E1

23 4

21

Page 70: 1 Concurrent Counting is harder than Queuing Costas Busch Rensselaer Polytechnic Intitute Srikanta Tirthapura…

70

A

C

E

B

FD

Nearest Neighbor TSP tour

A

C

D

B

F2

4

41

3

1 2

31

E1

23 4

21

Length=8

Page 71: 1 Concurrent Counting is harder than Queuing Costas Busch Rensselaer Polytechnic Intitute Srikanta Tirthapura…

71

A

C

E

B

FD

A

C

D

B

F2

4

41

3

1 2

31

E1

23 4

21

Optimal TSP tour

Length=6

Page 72: 1 Concurrent Counting is harder than Queuing Costas Busch Rensselaer Polytechnic Intitute Srikanta Tirthapura…

72

It can be shown that:

Optimal TSP length n2

A

C

E

B

FD

(Nodes in graph)

Since every edge is visited twice

Page 73: 1 Concurrent Counting is harder than Queuing Costas Busch Rensselaer Polytechnic Intitute Srikanta Tirthapura…

73

Therefore, for constant degree spanning tree:

Queuing Cost = O(Nearest-Neighbor TSP)

)log( nnO= O(Optimal TSP x )nlog

=

Page 74: 1 Concurrent Counting is harder than Queuing Costas Busch Rensselaer Polytechnic Intitute Srikanta Tirthapura…

74

For special cases we can do better:

Spanning Tree is

Queuing Cost = )(nO

List balanced binary tree

Page 75: 1 Concurrent Counting is harder than Queuing Costas Busch Rensselaer Polytechnic Intitute Srikanta Tirthapura…

75

Graphs with Hamiltonian path,have spanning trees which are lists

Complete graph

Queuing Cost = )(nO

Mesh Hypercube

Counting Cost = )log( * nn

Page 76: 1 Concurrent Counting is harder than Queuing Costas Busch Rensselaer Polytechnic Intitute Srikanta Tirthapura…

76

If the spanning tree is a list, then

Theorem:

Queuing Cost = )(nO

Page 77: 1 Concurrent Counting is harder than Queuing Costas Busch Rensselaer Polytechnic Intitute Srikanta Tirthapura…

77

Nearest Neighbor TSP

Queuing Cost = O(Nearest-Neighbor TSP)

Proof:

Page 78: 1 Concurrent Counting is harder than Queuing Costas Busch Rensselaer Polytechnic Intitute Srikanta Tirthapura…

78

x yyx

ab

ab 2

Page 79: 1 Concurrent Counting is harder than Queuing Costas Busch Rensselaer Polytechnic Intitute Srikanta Tirthapura…

79

Length doubles

Total length n2

n nodes

Even sides

Page 80: 1 Concurrent Counting is harder than Queuing Costas Busch Rensselaer Polytechnic Intitute Srikanta Tirthapura…

80

Length doubles

n nodes

Total length n2

Odd sides

Page 81: 1 Concurrent Counting is harder than Queuing Costas Busch Rensselaer Polytechnic Intitute Srikanta Tirthapura…

81

n nodes

Total length nnn 422

Even+Odd sides

End of proof