14
Introduction to Introduction to computer computer networking networking Distributed Algorithms Distributed Algorithms Class Recitation Class Recitation

Introduction to computer networking Distributed Algorithms Class Recitation

  • View
    226

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Introduction to computer networking Distributed Algorithms Class Recitation

Introduction to Introduction to computer computer

networkingnetworkingDistributed Algorithms Class Distributed Algorithms Class

RecitationRecitation

Page 2: Introduction to computer networking Distributed Algorithms Class Recitation

Ex. 1 - PIF RevisitedEx. 1 - PIF Revisited• Given the PIF algorithm:

Init: l N(l)0; m0; p0Upon receipt of MSGs(l)

N(l)1if m=0 then

p1send MSGs to all lN-{l}

m1if l’ holds N(l’)=1 then

send MSGs to p m0 l’ N(l’)0

• Is it possible that a node i will send messages to all itsneighbors except its parent, p, before node p has?

• Is it possible for node i to send a message to its parent p before node j has finished sending messages to its neighbors?

Page 3: Introduction to computer networking Distributed Algorithms Class Recitation

T=0T=0

node no. 1 node no. 2 node no. 3 node no. 4time link m1 N1(1) N1(2) p1 m2 N2(1) N2(2) N2(3) p2 m3 N3(1) N3(2) N3(3) p3 m4 N4(1) N4(2) p4

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1

QuickTime™ and aTIFF (LZW) decompressor

are needed to see this picture.

Page 4: Introduction to computer networking Distributed Algorithms Class Recitation

T=3T=3

node no. 1 node no. 2 node no. 3 node no. 4time link m1 N1(1) N1(2) p1 m2 N2(1) N2(2) N2(3) p2 m3 N3(1) N3(2) N3(3) p3 m4 N4(1) N4(2) p4

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 13 (1,2) 1 1 1

QuickTime™ and aTIFF (LZW) decompressor

are needed to see this picture.

Page 5: Introduction to computer networking Distributed Algorithms Class Recitation

T=4T=4

node no. 1 node no. 2 node no. 3 node no. 4time link m1 N1(1) N1(2) p1 m2 N2(1) N2(2) N2(3) p2 m3 N3(1) N3(2) N3(3) p3 m4 N4(1) N4(2) p4

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 13 (1,2) 1 1 14 (2,4) 1 1 1

QuickTime™ and aTIFF (LZW) decompressor

are needed to see this picture.

Page 6: Introduction to computer networking Distributed Algorithms Class Recitation

T=5T=5

node no. 1 node no. 2 node no. 3 node no. 4time link m1 N1(1) N1(2) p1 m2 N2(1) N2(2) N2(3) p2 m3 N3(1) N3(2) N3(3) p3 m4 N4(1) N4(2) p4

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 13 (1,2) 1 1 14 (2,4) 1 1 15 (2,3) 1 1 25 (4,3) 1

QuickTime™ and aTIFF (LZW) decompressor

are needed to see this picture.

Page 7: Introduction to computer networking Distributed Algorithms Class Recitation

T=6T=6

node no. 1 node no. 2 node no. 3 node no. 4time link m1 N1(1) N1(2) p1 m2 N2(1) N2(2) N2(3) p2 m3 N3(1) N3(2) N3(3) p3 m4 N4(1) N4(2) p4

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 13 (1,2) 1 1 14 (2,4) 1 1 15 (2,3) 1 1 25 (4,3) 16 (1,3) 0 1/0 /0 /06 (3,4) 0 /0 1/0

QuickTime™ and aTIFF (LZW) decompressor

are needed to see this picture.

Page 8: Introduction to computer networking Distributed Algorithms Class Recitation

T=7T=7

node no. 1 node no. 2 node no. 3 node no. 4time link m1 N1(1) N1(2) p1 m2 N2(1) N2(2) N2(3) p2 m3 N3(1) N3(2) N3(3) p3 m4 N4(1) N4(2) p4

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 13 (1,2) 1 1 14 (2,4) 1 1 15 (2,3) 1 1 25 (4,3) 16 (1,3) 0 1/0 /0 /06 (3,4) 0 /0 1/07 (4,2) 1

QuickTime™ and aTIFF (LZW) decompressor

are needed to see this picture.

Page 9: Introduction to computer networking Distributed Algorithms Class Recitation

T=8T=8

node no. 1 node no. 2 node no. 3 node no. 4time link m1 N1(1) N1(2) p1 m2 N2(1) N2(2) N2(3) p2 m3 N3(1) N3(2) N3(3) p3 m4 N4(1) N4(2) p4

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 13 (1,2) 1 1 14 (2,4) 1 1 15 (2,3) 1 1 25 (4,3) 16 (1,3) 0 1/0 /0 /06 (3,4) 0 /0 1/07 (4,2) 18 (3,2) 0 /0 1/0 /0

QuickTime™ and aTIFF (LZW) decompressor

are needed to see this picture.

Page 10: Introduction to computer networking Distributed Algorithms Class Recitation

T=11T=11

node no. 1 node no. 2 node no. 3 node no. 4time link m1 N1(1) N1(2) p1 m2 N2(1) N2(2) N2(3) p2 m3 N3(1) N3(2) N3(3) p3 m4 N4(1) N4(2) p4

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 13 (1,2) 1 1 14 (2,4) 1 1 15 (2,3) 1 1 25 (4,3) 16 (1,3) 0 1/0 /0 /06 (3,4) 0 /0 1/07 (4,2) 18 (3,2) 0 /0 1/0 /0

11 (3,1) 111 (2,1) 0 1/0 /0 /0

QuickTime™ and aTIFF (LZW) decompressor

are needed to see this picture.

Page 11: Introduction to computer networking Distributed Algorithms Class Recitation

Ex. 2Ex. 2

• Given the PIFD algorithm, which is similar to the PIF algorithm, albeit with a second (other than the source) unique node D which behaves differently from the other nodes. For each of the following claims, determine whether the claim is true or false:

Page 12: Introduction to computer networking Distributed Algorithms Class Recitation

The ClaimsThe Claims• All the nodes will receive the message after a

finite time period and all will have m=1 eventually.

• The algorithm ends. i.e. there is a finite time after which no more messages are transferred.

• The source node knows when the algorithm has finished

• When the source node finishes the algorithm, the algorithm has ended.

Page 13: Introduction to computer networking Distributed Algorithms Class Recitation

QuickTime™ and aTIFF (LZW) decompressor

are needed to see this picture.

PIFD

Algorithm For Node D:Init: Init: l N(l)0; m0; p0Upon receipt of MSGs(l)

N(l)1if m=0 then

p1send MSGs to all neighbours m1

Page 14: Introduction to computer networking Distributed Algorithms Class Recitation

The Claims RevisitedThe Claims Revisited• All the nodes will receive the message after a finite time

period and all will have m=1 eventually.• The algorithm ends. i.e. there is a finite time after which

no more messages are transferred.• The source node knows when the algorithm has finished• When the source node finishes the algorithm, the

algorithm has ended.