università degli studi dell’aquila academic year 2009/2010 course: algorithms for distributed...

20
Università degli Studi dell’Aquila Academic Year 2009/2010 Course: Algorithms for Distributed Systems Instructor: Prof. Guido Proietti Time: Monday: 10.15 – 11.45 – Room 0.6 Wednesday: 11.45 – 13.30 – Room 0.6 Questions?: Wednesday 16.30-17.30 ides plus other infos: http://www.di.univaq.it/~proietti/didattica.html

Post on 18-Dec-2015

218 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Università degli Studi dell’Aquila Academic Year 2009/2010 Course: Algorithms for Distributed Systems Instructor: Prof. Guido Proietti Time: Monday: 10.15

Università degli Studi dell’AquilaAcademic Year 2009/2010

Course: Algorithms for Distributed SystemsInstructor: Prof. Guido Proietti

Time: Monday: 10.15 – 11.45 – Room 0.6 Wednesday: 11.45 – 13.30 – Room 0.6Questions?: Wednesday 16.30-17.30

Slides plus other infos:http://www.di.univaq.it/~proietti/didattica.html

Page 2: Università degli Studi dell’Aquila Academic Year 2009/2010 Course: Algorithms for Distributed Systems Instructor: Prof. Guido Proietti Time: Monday: 10.15

Distributed System

Set of computational devices connected by a communication network.

Old platform : Usually a number of WSs over a LAN

Now, ranges from a LAN to a sensor network to a mobile network

Each node in a DS :

is autonomous communicates by messages needs to synchronize with others to achieve a

common goal (load balancing, fault tolerance, an application..)

Page 3: Università degli Studi dell’Aquila Academic Year 2009/2010 Course: Algorithms for Distributed Systems Instructor: Prof. Guido Proietti Time: Monday: 10.15

Modern Distributed Applications

Collaborative computing Military command and control Online strategy games Massive computation

Distributed Real-time Systems

Process Control Navigation systems, Airline Traffic Monitoring (ATM)

Mobile Ad hoc Networks Rescue Operations, emergency operations, robotics

Wireless Sensor Networks Habitat monitoring, intelligent farming

Grid

Stock market

Page 4: Università degli Studi dell’Aquila Academic Year 2009/2010 Course: Algorithms for Distributed Systems Instructor: Prof. Guido Proietti Time: Monday: 10.15

The Internet

Page 5: Università degli Studi dell’Aquila Academic Year 2009/2010 Course: Algorithms for Distributed Systems Instructor: Prof. Guido Proietti Time: Monday: 10.15

Some Issues in Building Distributed Applications

Reliability (connectivity)

Security (cryptography)

Consistency (mutual exclusion)

Cooperativeness (game theory)

Fault-tolerance (failures, recoveries…)

Scalability: How is the performance affected as the number of nodes increase ?

Performance: What is the complexity of the designed algorithm?

Page 6: Università degli Studi dell’Aquila Academic Year 2009/2010 Course: Algorithms for Distributed Systems Instructor: Prof. Guido Proietti Time: Monday: 10.15

Course structureFIRST PART: Algorithms for COOPERATIVE DS

1. Leader Election2. Minimum spanning tree3. Maximal independent set

SECOND PART: Algorithms for UNRELIABLE DS1. Benign failures: consensus problem2. Byzantin failures: consensus problem

THIRD PART: Algorithms for CONCURRENT DS1. Mutual exclusion

Mid-term Written Examination: First (?) week of December

FOURTH PART: DS SECURITY1. Elements of cryptography

FIFTH PART: Algorithms for NON COOPERATIVE (STRATEGIC) DS1. Strategic equilbria theory2. Algorithmic mechanism design (AMD)3. AMD for Graph optimization problems

SIXTH PART (???): Algorithms for WIRELESS DS

Final Oral Examination: depending of the mid-term rate

Page 7: Università degli Studi dell’Aquila Academic Year 2009/2010 Course: Algorithms for Distributed Systems Instructor: Prof. Guido Proietti Time: Monday: 10.15

Cooperative distributed Cooperative distributed algorithms: algorithms:

Message Passing SystemMessage Passing System

Cooperative distributed Cooperative distributed algorithms: algorithms:

Message Passing SystemMessage Passing System

A Formal ModelA Formal Model

Page 8: Università degli Studi dell’Aquila Academic Year 2009/2010 Course: Algorithms for Distributed Systems Instructor: Prof. Guido Proietti Time: Monday: 10.15

The System Topology: a network (connected undirected graph)

Processors (nodes) Communication channels (edges)

Degree of synchrony: asynchronous versus synchronous (universal clock)

Degree of symmetry: anonymous (processors are indistinguishable) versus non-anonymous

Degree of Uniformity: uniform (number of processors is unknown) versus non-uniform

Local algorithm: the algorithm associated to a single processor

Distributed algorithm: the “composition” of local algorithms

Page 9: Università degli Studi dell’Aquila Academic Year 2009/2010 Course: Algorithms for Distributed Systems Instructor: Prof. Guido Proietti Time: Monday: 10.15

Notation n processors: p0, p1, … , pn-1.

Each processor knows nothing about the network topology, except for its neighbors, numbered from from 1 to r

Communication takes place only through message exchanges, using buffers associated with each neighbor, namely outbufi[k], inbufi[k], i=1,…,r.

qi : the state set for pi, containing a distinguished initial state; each state describes the internal status of the processor and the status of the buffers

Page 10: Università degli Studi dell’Aquila Academic Year 2009/2010 Course: Algorithms for Distributed Systems Instructor: Prof. Guido Proietti Time: Monday: 10.15

Configuration and events

System configuration: A vector [q0,q1,…,qn-1] where qi is the state of pi

Events: Computation events (internal computations plus sending of messages), and message delivering events

Page 11: Università degli Studi dell’Aquila Academic Year 2009/2010 Course: Algorithms for Distributed Systems Instructor: Prof. Guido Proietti Time: Monday: 10.15

ExecutionC0 1 C1 2 C2 3 … where

Ci : A configuration

i : An event

C0 : An initial configuration

Page 12: Università degli Studi dell’Aquila Academic Year 2009/2010 Course: Algorithms for Distributed Systems Instructor: Prof. Guido Proietti Time: Monday: 10.15

Asynchronous SystemsNo upper bound on delivering

timesAdmissible execution: each

message sent is eventually delivered

Page 13: Università degli Studi dell’Aquila Academic Year 2009/2010 Course: Algorithms for Distributed Systems Instructor: Prof. Guido Proietti Time: Monday: 10.15

Synchronous Systems Each processor has a (common)

clock, and computation takes place in rounds.

At each round each processor: 1. Reads the incoming messages buffer2. Makes some internal computations3. Sends messages which will be read in

the next round.

Page 14: Università degli Studi dell’Aquila Academic Year 2009/2010 Course: Algorithms for Distributed Systems Instructor: Prof. Guido Proietti Time: Monday: 10.15

Message Complexity The total number of messages

sent during any admissible execution of the algorithm.

In other words, the number of delivery events.

Page 15: Università degli Studi dell’Aquila Academic Year 2009/2010 Course: Algorithms for Distributed Systems Instructor: Prof. Guido Proietti Time: Monday: 10.15

Time Complexity Synchronous: The number of

rounds until termination.Asynchronous: not really

meaningful

Page 16: Università degli Studi dell’Aquila Academic Year 2009/2010 Course: Algorithms for Distributed Systems Instructor: Prof. Guido Proietti Time: Monday: 10.15

• Example: Distributed Depth-First Search– General overview of a sequential algorithm:

– Begin at some source vertex, r0

– when reaching any vertex v» if v has an unvisited neighbor, then visit it and

proceed from it» otherwise, return to parent(v)

– when we reach the parent of some vertex v such that parent(v) = NULL, then we terminate since v = r0

– DFS defines a tree, with r0 as the root, which reaches all vertices in the graph

– “back edges” = graph edges not in tree– sequential time complexity = O(|edges|+|nodes|)

Page 17: Università degli Studi dell’Aquila Academic Year 2009/2010 Course: Algorithms for Distributed Systems Instructor: Prof. Guido Proietti Time: Monday: 10.15

DFS: an example (1/2)

Page 18: Università degli Studi dell’Aquila Academic Year 2009/2010 Course: Algorithms for Distributed Systems Instructor: Prof. Guido Proietti Time: Monday: 10.15

DFS: an example (2/2)

Page 19: Università degli Studi dell’Aquila Academic Year 2009/2010 Course: Algorithms for Distributed Systems Instructor: Prof. Guido Proietti Time: Monday: 10.15

• Distributed DFS (cont’d.)– Distributed version (token-based): the

token traverses the graph in a depth-first manner using the algorithm described above

1. Start exploration (visit) at root r.2. When v is visited for the first time:

2.1 Inform all neighbors of v that v has been visited.2.2 Wait for acknowledgment from all neighbors.2.3 Resume the DFS process.

– Message complexity is O(|E|) (optimal, because of the lower bound of (|edges|) to explore every edge)

» note that edges are not examined from both endpoints; when edges (v,w) is examined by v, w then knows that v has been visited

Page 20: Università degli Studi dell’Aquila Academic Year 2009/2010 Course: Algorithms for Distributed Systems Instructor: Prof. Guido Proietti Time: Monday: 10.15

• Distributed DFS (cont’d.)•Time complexity analysis (sync. DS)

We ensure that vertices visited for the first time know which of their neighbors have/have not been visited; thus we make no unnecessary vertex explorations:

»algorithm: freeze the DFS process; inform all neighbors of v that v has been visited; get Ack messages from those neighbors; restart DFS process constant number of rounds for each new discovered node

»only O(n) nodes are discovered time complexity = O(n)