A C OMBINATORIAL C HARACTERIZATION OF THE D ISTRIBUTED 1-S OLVABLE T ASKS Ofer Biran, Shlomo Moran,...

Preview:

Citation preview

A COMBINATORIAL CHARACTERIZATION OF THE DISTRIBUTED 1-SOLVABLE TASKS Ofer Biran, Shlomo Moran, Shmuel Zaks

Presented by Ami Paz

Technion, Haifa, Israel

January 2011

ROADMAP

•Informal definition of 1-Solvability

•Examples

Introduction

•Tasks & Protocols

•Solvability & 1-Solvability

Model & Definitions

•Connectivity condition

•Extendibility condition

1-Solvability conditions

•1-Solvability iff conditions

•A universal protocol

Necessary & sufficient

cond’s

ROADMAP

•Informal definition of 1-Solvability

•Examples

Introduction

•Tasks & Protocols

•Solvability & 1-Solvability

Model & Definitions

•Connectivity condition

•Extendibility condition

1-Solvability conditions

•1-Solvability iff conditions

•A universal protocol

Necessary & sufficient

cond’s

1-SOLVABLE TASKS – INFORMAL

Asynchronies system. N processors p1,…,pN. All the processes are connected to one another.

There are no limitations on the messages (number or size).

But: One process may Crash during the run. Only a fault crash is allowed.

Which problems can be solved?

EXAMPLE 1: WEAK CONSENSUS

Each processor has initial value of 0 or 1. Should all decide on 0 or 1.

11

0

0

1

00

00

0

CONSENSUS ALG.: TAKE I

Algorithm: if someone has 0, all decide 0.

11

0

CONSENSUS ALG.: TAKE I

Algorithm: if someone has 0, all decide 0.

00

0

CONSENSUS ALG.: TAKE II

Algorithm: if someone has 0, all decide 0.

11

CONSENSUS ALG.: TAKE II

Algorithm: if someone has 0, all decide 0.

??

CONSENSUS ALG.: TAKE II

Algorithm: if someone has 0, all decide 0.

Let’s go for

1

He’s dead

?

CONSENSUS ALG.: TAKE II

Algorithm: if someone has 0, all decide 0.

11

CONSENSUS ALG.: TAKE III

Algorithm: if someone has 0, all decide 0.

11

Zzz…

CONSENSUS ALG.: TAKE III

Algorithm: if someone has 0, all decide 0.

??

Zzz…

CONSENSUS ALG.: TAKE III

Algorithm: if someone has 0, all decide 0.

Let’s go for

1

He’s dead

?

Zzz…

CONSENSUS ALG.: TAKE III

Algorithm: if someone has 0, all decide 0.

11

Zzz…

0

Guys?

EXAMPLE 2:ORDER PRESERVING RENAMING

Each processor starts with a rational value. Rename to values 1…10, while preserving

order.

-31

7

1000

20

13

49

5

OPR ALG.: TAKE I

-3 12

16

OPR ALG.: TAKE I

25

8

OPR ALG.: TAKE II

-2 12

OPR ALG.: TAKE II

??

OPR ALG.: TAKE II

Never mind

He’s dead

?

OPR ALG.: TAKE II

25

OPR ALG.: TAKE III

-3 12

Zzz…(16)

OPR ALG.: TAKE III

??

Zzz…(16)

OPR ALG.: TAKE III

Never mind

He’s dead

?

Zzz…(16)

Zzz…(16)

OPR ALG.: TAKE III

25

16

I decide:

7

OPR ALG.: TAKE IV

-3 12

Zzz…(9)

OPR ALG.: TAKE IV

25

Zzz… (9) 9

I decide:

3

What if we had to rename to values

1…3?

1...4?

ROADMAP

• Informal definition of 1-Solvability• Examples

Introduction

• Tasks & Protocols• Solvability & 1-Solvability

Model & Definitions

• Connectivity condition• Extendibility condition

1-Solvability conditions

• 1-Solvability iff conditions• A universal protocol

Necessary & sufficient cond’s

ASYNCHRONOUS DISTRIBUTED NETWORK

N–processes, N≥3. Unique identities, Mutually known.

Also: may not be mutually known.

Massages pass along communication lines: Arrive with no error. Arrive in finite, unbounded and

unpredictable time.

Complete network. Also: bi-connected network

(connected even after removing one process).

DECISION TASK

A mapping of possible inputs to allowable outputs.

Let X be a set of input values. Let D be a set of output values.

A distributed decision task T is a function:

Where XT ⊆ XN is the set of allowable inputs of T.

: \NT PT DX

Maps each allowed vector to a set of legal

outputs

EXAMPLE 1: WEAK CONSENSUS - REVISED

Each processors has initial value of 0 or 1. Should all decide on 0 or 1.

Task formulation:

0,1N

TX : 0,0, ,0 , 1,1, ,1TT X

This does not rule out trivial solutions

EXAMPLE 1.5: STRONG CONSENSUS

Each processor has initial value of 0 or 1. Should all decide on 0 or 1. Starting with consensus, should end up with

the same value.

Task formulation:

0,1N

TX

:

0 0

0 1 0,1

1 1

,T

x

x x

x

WHY DO WE CARE ABOUT CONSENSUS?

Xor is a consensus task

Majority is a consensus task

Consensus can be done by leader election. So, impossibility of consensus implies

impossibility of leader election.

1: , Xo ,, r ,XorN i iT x x x x

1: , Ma ,, j ,MajN i iT x x x x

Can leader

election be done byconsensus

?

EXAMPLE 2:ORDER PRESERVING RENAMING -

REVISED

Each processors start with a rational value. Rename to values 1…k, while preserving

order.

Task formulation:

1, ,T N i j ixX x x x x

1 1: , ,

. .

1

N N

i j i j

i

T x d

s t x d

x d

x d

d k

PROTOCOLS AND SOLVABILITY

A Protocol α for a given network is a set ofN programs, each associated with a processor.

A protocol α solves a task T if for any input vector x∈XT, it satisfies:

1. All execution are complete.

2. All Execution outputs are legal.

FAULTS

A processor P is faulty in an execution e if all messages sent by P during e after a certain time are never received. This is called a crash fault.

No Byzantine faults here…

1-SOLVABILITY

A protocol α 1-solves a Task T if:1. If no processor is faulty, it solves the task.2. If in an execution a processor is faulty, then all

other processors eventually decide.

If there exist such a protocol, we say the task T is 1-solvable.

ROADMAP

• Informal definition of 1-Solvability• Examples

Introduction

• Tasks & Protocols• Solvability & 1-Solvability

Model & Definitions

• Connectivity condition• Extendibility condition

1-Solvability conditions

• 1-Solvability iff conditions• A universal protocol

Necessary & sufficient cond’s

ADJACENCY GRAPH

Let for some set A. Two vectors in A are adjacent if they differ

only in one entry. The adjacency graph of S is denoted by

G(S).

NS A

(1,2,4) (1,3,4)

(2,3,4)

(2,3,5) (2,4,5)

(1,2,4) (1,3,4)

(2,3,4)

(2,3,5) (2,4,5)

SG(S

)

CONNECTIVITY THM.[MW]

If, for a task T: The input graph is connected A protocol α 1-solves T

Then: The output graph of α is connected.

CONNECTIVITY – EXAMPLE 1:WEAK CONSENSUS

α for all Pi: decide “1”.

Input graph

(0,0,1)

(0,0,0)

(0,1,0)

(1,0,0)

(0,1,1)

(1,0,1)

(1,1,0)

(1,1,1)

(1,1,1)

Output graphα

CONNECTIVITY – EXAMPLE 2:STRONG CONSENSUS

Is there a protocol α which 1-solves T?

Input graph

(0,0,1)

(0,0,0)

(0,1,0)

(1,0,0)

(0,1,1)

(1,0,1)

(1,1,0)

(1,1,1)

α

(1,1,1)

Output graph

(0,0,0)

Input graph is connected,α 1-solves T,But:The output graph of α

is not connected!

THE CONNECTIVITY CONDITION

Let T be a decision task. For any set of allowable inputs C, if:

G(C) is a connected subgraph of the input graph A protocol α 1-solves T

Then: The output graph of α induced by running α on

the inputs in C is connected.

Easy to deduce from the last

Thm.:

Define a new task with input C,

and the output induced by α and

C.

CONNECTIVITY – EXAMPLE 3:STRONG CONSENSUS WITH MAJORITY

Can we solve Strong Consensus, if we have a promise that there is a majority?

αInput graph

(0,0,0,0)

(0,0,0,1)

(0,0,1,0)

(0,1,0,0)

(1,0,0,0)

(1,1,1,1)

(1,1,1,0)(1,1,0,

1)(1,0,1,

1)(0,1,1,

1)

(1,1,1,1)

(0,0,0,0)

Output graph

The connectivity condition

does not deny such a

protocol

INDUCED TASK

Let α be a protocol that solves a task T. We denote by Tα the task induced by α and

XT. Tα is defined by:

XT α = XT

The allowable outputs of Tα are all the possible outputs of α and XT.

EXAMPLE: STRONG CONSENSUS

Task formulation: T:

Protocol α: every Pi chooses by majority. Tα:

0,1N

TX :

0 0

0 1 0,1

1 1

,T

x

x x

x

0,1N

TX

:0 Maj 0

1 Maj 1T

xx

x

POINTWISE CONNECTIVITY

A task T is pointwise connected if G(T(x)) is connected for each x∈XT. i.e., the output graph for each input vector is

connected.

So, from the connectivity condition we get the following corollary: Let α be a protocol that 1-solves a task T,

then Tα is pointwise connected.

ROADMAP

• Informal definition of 1-Solvability• Examples

Introduction

• Tasks & Protocols• Solvability & 1-Solvability

Model & Definitions

• Connectivity condition• Extendibility condition

1-Solvability conditions

• 1-Solvability iff conditions• A universal protocol

Necessary & sufficient cond’s

VECTORS AND EXECUTIONS

A partial vector is a vector in which one of its’ entries is not specified. For a vector s=(s1,…,sN), We denote: si=(s1,…,si-1,*,si+1,…,sN). s is an extension of si.

Let xi be a partial input vector, and di a partial decision vector of a task T.

di is a covering vector of xi if: For each extension of xi to a legal input vector x,

there is an extension of di to a decision vector d,such that d is a legal decision vector of T on x.

I-SLEEPING EXECUTION

Let α be a protocol that 1-solves T. An i-sleeping execution of α is an

execution in which all messages sent by Pi are delayed until all other processors decide.

Zzz…We know that such an execution exists, since:1. α 1-solves T.2. Sleeping Pi is

indistinguishable from faulty Pi.

THE EXTENDIBILITY CONDITION

Let α be a protocol that 1-solves a task T, thanin Tα (the task induced by α and XT) :

For each partial input vector, there is a covering vector.

Why looking in Tα rather then T?

- Because we’re only interested

in the possible outputs of α.

EXTENDIBILITY – EXAMPLEOPR

OPR (Order Preserving Renaming): N=3 processors. Each processors start with a rational value. Rename to values 1 to k=4, while preserving

order.

12

10

13

2

1

4

EXTENDIBILITY – EXAMPLEOPR (2)

Let v3=(10,12,*) be a partial input vector. Can it have a covering vector?

Extensions of v3 and their possible outputs: T((10,12,13)) = { (1,2,3), (1,2,4), (1,3,4), (2,3,4) } T((10,12,11)) = { (1,3,2), (1,4,2), (1,4,3), (2,4,3) } T((10,12, 9)) = { (2,1,3), (2,4,1), (3,4,1), (3,4,2) }

Partial output vectors: T((10,12,13))3 = { (1,2,*), (1,3,*), (2,3,*) } T((10,12,11))3 = { (1,3,*), (1,4,*), (2,4,*) } T((10,12, 9))3 = { (2,1,*), (2,4,*), (3,4,*) }

Note: T((10,12,13))3 ∩ T((10,12,11))3 ∩ T((10,12, 9))3=∅.

EXTENDIBILITY – EXAMPLEOPR (3)

Let v3=(10,12,*) be a partial input vector. Can it have a covering vector? Assuming a protocol α solving OPR.

By the extendibility condition, v3 has a covering vector. This covering vector should be a legal output of T on

any extension of v3. but: T((10,12,13))3 ∩ T((10,12,11))3 ∩ T((10,12, 9))3 = ∅. Hence, no such covering vector, and no such

protocol.

THE EXTENDIBILITY CONDITION (2)

Let α be a protocol that 1-solves a task T, thanin Tα: For each partial input vector xi, there is a covering

vector di.Proof: Let xi = (x1,…,xi-1,*,xi+1,…,xN) be a part. input

vector. Consider an i-sleeping execution of α on xi. Let di = (d1,…,di-1,*,di+1,…,dN) be the partial output

vector.

We will show that di is a covering vector for xi.

THE EXTENDIBILITY CONDITION (3)

Proof (cont’d): Let xi = (x1,…,xi-1,*,xi+1,…,xN) partial input vector.

Let di = (d1,…,di-1,*,di+1,…,dN) output vector.

di is a covering vector for xi: Let y = (x1,…,xi-1,yi,xi+1,…,xN) be a legal

extension of xi. Assume y is the actual input vector for α, and

that Pi is eventually awakened. So Pi finally decides on some di.

d = (d1,…,di,…,dN) is the desired extension of di.

ANCHORS

A vector d is an i-anchor of an input vector x if: d is a legal output for T on x. di is a covering vector for xi.

The vector d = (d1,…,di,…,dN) we saw in the last proof was an anchor for y = (x1,…,xi-

1,yi,xi+1,…,xN).

EXTENDIBILITY – EXAMPLECONT’D

We saw that OPR with N=3 and k=4 is impossible in the presence of one fault.

Actually, we saw that (10,12,13) has no 3-anchor: For each d which is a legal output for T on x, d3 is

not a covering vector for x3.

EXTENDIBILITY – EXAMPLE 2

We saw that OPR with N=3 and k=4 is impossible in the presence of one fault.

What about OPR with N=3 and k=5?

For the partial input vector v3=(10,12,*) and for the same extensions of it, partial output vectors are: T((10,12,13))3 = {(1,2,*) (1,3,*) (2,3,*) (1,4,*) (2,4,*)

(3,4,*)} T((10,12,11))3 = {(1,3,*) (1,4,*) (2,4,*) (1,5,*) (2,5,*)

(3,5,*)} T((10,12,9))3 = {(2,3,*) (2,4,*) (3,4,*) (2,5,*) (3,5,*)

(4,5,*)}

This time:T((10,12,13))3 ∩ T((10,12,11))3 ∩ T((10,12, 9))3={(2,4,*)}

EXTENDIBILITY – EXAMPLE 2CONT’D

OPR with N=3 and k=5.

Actually, for all the extensions of v3=(10,12,*) , the vector d3=(2,4,*) is the only covering vector. In this task, if a processor Pi is sleeping, the other

processors may eventually decide on 2 and 4. When Pi awakes, no matter what is its’ input, it

can always extend the partial decision vector by deciding on 1,3 or 5.

(2,4,1) is a 3-anchor for (10,12,9).Is this 3-anchor unique?Yes.

Is it always unique?No.

ROADMAP

•Informal definition of 1-Solvability

•Examples

Introduction

•Tasks & Protocols

•Solvability & 1-Solvability

Model & Definitions

•Connectivity condition

•Extendibility condition

1-Solvability conditions

•1-Solvability iff conditions

•A universal protocol

Necessary & sufficient

cond’s

TASK RESTRICTION

A task T’ is a restriction of a task T if: They have the same set of legal inputs For every legal input x: The allowable outputs of

T’ on x are also allowable outputs of T on x.

Note: for T’ which is a restriction of T,if a protocol α 1-solves T’, it also 1-solves T.

In particular, Tα, the task induced by T and α, is a restriction of T.

NECESSARY & SUFFICIENT CONDITIONS FOR 1-SOLVABILITY

A task T is 1-solvable if and only if there exists a restriction T’ of T satisfying:

a) T’ is pointwise connected

b) For each partial input vector xi, there is a covering vector di in T’;

Moreover, there is a (centralized) algorithm that on an input xi outputs such a di.

NECESSITY OF THE CONDITIONS - PROOF

Let T be a 1-solvable task, and α a protocol which 1-solvaes T. Take T’ to be Tα. Then:

a) By the corollary of the connectivity condition,Tα is pointwise connected.

b) By the extendibility condition, Tα contains a covering vector for each partial input vector xi .

Moreover, for each xi the corresponding di can be calculated by simulating an i-sleeping run of α.

NECESSITY OF THE CONDITIONS AN EXAMPLE: OPR

OPR with N=3 and k=5. take T’=T.a) T’ is pointwise connected:

Take x=(10,12,13)∈XT. Is G(T’(x)) connected?

G(T’(x))

(1,3,4)

(1,2,3)

(1,2,5)

(1,2,4) (1,3,5)

(1,4,5)

(2,3,4)

(2,3,5)

(2,4,5)

(3,4,5)

T’(x)

NECESSITY OF THE CONDITIONSAN EXAMPLE: OPR (CONT’D)

OPR with N=3 and k=5. take T’=T.b) For each partial input vector xi, there is a

covering vector di in T’: Take x3 = (10,12,*)∈XT. d3 = (2,4,*) is a covering vector.

Moreover, there is a (centralized) algorithm that on an input xi outputs such a di: Set 2 and 4 to the non-sleeping processors, preserving

their initial order.

SUFFICIENCY OF THE CONDITIONS:A UNIVERSAL ALGORITHM

Let T be a task which has a restriction T’ satisfying (a) and (b). By (a), G(T’(x)) is connected. Hence, for a given

finite set Sx of i-anchors of x, there is a finite tree TRx in G(T’(x)) that contains Sx.

For T’ there are the algorithms:a) TREE (x, Sx) – for an input x and a finite set

Sx of i-anchors of x, outputs TRx and a root rx which is an arbitrary vertex in TRx.

b) COVER (xi) – for a partial input vector xi, outputs a partial covering vector, di.

A UNIVERSAL ALGORITHM

We assume all the processors have copies of the algorithms TREE and COVER.

The protocol, for Pk: First, broadcast your value xk, and try to find

out x. When you know all the values but xi, broadcast

xi. If you get N-1 partial vectors (including yours)

which are equal (to xi), calculate di = COVER(xi). Decide on (di)k. Broadcast the decision on di and halt.

As far as Pk knows, Pi is dead.

Pk decides on a legal vector,

which Pi could extend if he

wakes up.

A UNIVERSAL ALGORITHM(CONT’D)

The protocol, for Pk (cnot’d): If you get N-1 partial vectors that are not equal,

deduce x from them. Compute N anchors A1,…,AN.

Ai is an extension of di = COVER(xi) to an i-anchor of x. Compute the tree TRx = TREE (x,A1,…,AN).

Decide, with all other processors, on a vertex on TRx.Every Pk calculates the same

tree

This is done by phases: each

processor suggests a vertex, and if

there is a disagreement, all the

processors move towards the root.

UNIVERSAL ALGORITHM – RUNNING EXAMPLE

0 16

320

Zzz(16)

0 3 20

(0,3,*,20) (0,3,*,20) (0,3,*,20)

(0,3,*,20) (0,3,*,20) (0,3,*,20)

(2,4,*,6) (2,4,*,6) (2,4,*,6)

2 4 6

(2,4,*,6) (2,4,*,6) (2,4,*,6)

Broadcast xk

Try to find out xBroadcast xi

calculate di=COVER(xi)

Decide (di)k

Broadcast the decisionHalt

UNIVERSAL ALGORITHM – RUNNING EXAMPLE

0 16

320

Zzz(16)

0 3 20

(0,3,*,20) (0,3,*,20) (0,3,*,20)

Broadcast xk

Try to find out xBroadcast xi

deduce x

Compute TRx

16

(0,3,16,*)

(0,3,16,*)

(0,3,16,20)

(0,3,16,20)

UNIVERSAL ALGORITHM – RUNNING EXAMPLE

0 16

320

Compute TRx

(1,3,4,6)

(2,3,4,6)

(2,3,5,6)

(2,4,5,6)

(2,4,5,7)

(1,2,4,6)

(2,4,6,7)

Decide, with all other processors, on a vertex on TRx. (2,4,*,6) (2,4,*,6) (2,4,*,6)

(2,4,5,6)

Decide: 5

(2,4,5,6)

ROADMAP

•Informal definition of 1-Solvability

•Examples

Introduction

•Tasks & Protocols

•Solvability & 1-Solvability

Model & Definitions

•Connectivity condition

•Extendibility condition

1-Solvability conditions

•1-Solvability iff conditions

•A universal protocol

Necessary & sufficient

cond’s

ACKNOWLEDGMENT

Bug drawing adopted from Maurice Herlihy, “The Art of Multiprocessor Programming” .

1 1

1

REFERENCE

O. Biran, S. Moran and S. Zaks,A Combinatorial Characterization of the

Distributed Tasks Which Are Solvable in the Presence of One Faulty Processor,

J. of Algorithms, 1990.

Recommended