The iterated shared memory model of computation and an enrichment with safe-consensus tasks
description
Transcript of The iterated shared memory model of computation and an enrichment with safe-consensus tasks
The iterated shared memory model of computation and an enrichment
with safe-consensus tasks
Rodolfo CondeJoint work with Sergio Rajsbaum
Instituto de MatemáticasUniversidad Nacional Autónoma de México
GETCO 2010
The Model
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
The Iterated Snapshot Shared Memory model
• We have n processes that communicate using a memory SM[i][0…n] (i ≥ 0) of Read/Write registers
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
The Iterated Snapshot Shared Memory model
• The computation proceeds in rounds
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
The Iterated Snapshot Shared Memory model
• In each round, a process P can atomically write to SM[i][P]
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
0 11
The Iterated Snapshot Shared Memory model
• each process can atomically read all of SM[i]
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
0 11
The Iterated Snapshot Shared Memory model
• In each round, the processes use a new memory array
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
0 11
0 10
Asynchronous
• The n processes are asynchronous– Arbitrary delays of any kind
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
Wait-Free
• The protocols are wait-free– All but one process can crash– A process cannot wait to hear from another
process
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
?
Generic Iterated Snapshot protocolinit r := 0; sm := input, dec := NULL;
loop foreverr := r + 1;SM[r].write(sm);sm := SM[r].snapshot();
/* Local computing */end loop
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
Generic Iterated Snapshot protocolinit r := 0; sm := input, dec := NULL;
loop foreverr := r + 1;SM[r].write(sm);sm := SM[r].snapshot();
/* Local computing */end loop
P writes sm to SM[r][P]
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
Generic Iterated Snapshot protocolinit r := 0; sm := input, dec := NULL;
loop foreverr := r + 1;SM[r].write(sm);sm := SM[r].snapshot();
/* Local computing */end loop
P reads all the array SM[r]
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
Two processes protocol
• One possible execution is the following: the two processes read and write concurrently
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
0 WRRD
1 WRRD
Two processes protocol
• We can represent this execution as a 1-simplex
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
0 WRRD
1 WRRD
Two processes protocol
• Each vertex represents the process view of the memory
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
0 WRRD
1 WRRD
01 01
Two processes protocol
• Another possible execution: One process is faster that the other
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
0 WRRD
1 WRRD
01 01
0 WRRD
1 WRRD
Two processes protocol
• The red process only sees itself, but the green can see both of them
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
0 WRRD
1 WRRD
01 01
0 WRRD
1 WRRD
0
Two processes protocol
• And the last possibility
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
0 WRRD
1 WRRD
01 01
0 WRRD
1 WRRD
0
0 WRRD
1 WRRD
Two processes protocol
• And the last possibility
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
0 WRRD
1 WRRD
01 01
0 WRRD
1 WRRD
0
0 WRRD
1 WRRD
1
Protocol complex (1 round)
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
01 01 01
The 2nd round
• The input for the 2nd round is any possible state after the first round
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
0 WRRD
1 WRRD
01 01
The 2nd round
• And the three possibilities repeat
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
0 WRRD
1 WRRD
01 01
0 WRRD
1 WRRD
The 2nd round
• And the three possibilities repeat
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
0 WRRD
1 WRRD
01 01
0 WRRD
1 WRRD
The 2nd round
• And the three possibilities repeat
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
0 WRRD
1 WRRD
01 01
0 WRRD
1 WRRD
Two processes protocols in the iterated model
• Given a possible input:– Each execution of a round is represented as a 1-
simplex– All possible executions are represented as a
simplicial complex (subdivision of a line)
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
Three processes protocols
• The state after an execution can be described by a triangle (2-simplex)
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
0 WRRD
0 WRRD
0 WRRD
Three processes protocols
• The state after an execution can be described by a triangle (2-simplex)
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
0 WRRD
0 WRRD
0 WRRD
000
00
00
Protocol complex (1st round)
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
Protocol complex (1st round)
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
0 WRRD
0 WRRD
0 WRRD
Protocol complex (1st round)
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
0 WRRD
0 WRRD
0 WRRD
Protocol complex (1st round)
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
0 WRRD
0 WRRD
0 WRRD
Protocol complex (1st round)
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
0 WRRD
0 WRRD
0 WRRD
Protocol complex (3 processes)
• For the 2nd round– Each triangle (state) of the 1st round subdivides in
the same way– Because we work in an iterated model– Recursive behaviour
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
Rercursive behaviour (2nd round)
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
Rercursive behaviour (2nd round)
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
Rercursive behaviour (2nd round)
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
Protocol complex (2nd round)
In general
• For n + 1 processes:– Each state of a protocol is represented as a n-
simplex– The executions of a protocol are represented as a
n-dimensional complex– A subdivision of the n-simplex !! [Gafni &
Borowsky]
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
The (n,k)-set agreement task[S. Chaudhuri, 90]
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
Set agreement
The (n,k)-set agreement task [S. Chaudhuri, 90]
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
Set agreement
2 7 9
Processes start with private input values from a domain I (|I| ≥ n)
The (n,k)-set agreement task [S. Chaudhuri, 90]
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
Set agreement
2 7 9
Their outputs must agree on at most k < n distinct values
7 7 2
Impossibility of (3,2)-set agreement in the Iterated model
• We can use the geometric view of distributed protocols to show this remarkable result.
• The basic idea is as follows:Assume a protocol exists.Find an execution of this protocol (using the protocol
complex) where processes decide 3 values !!!
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
Suppose a protocol exists
• Consider an input where processes have as input values their own ids
• Run the protocol until processes decide
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
Suppose a protocol exists
• Because we work in the iterated model– The protocol complex is a subdivision of the
triangle– We can colour the vertices with the decision each
process takes– This colouring satisfies the hypothesis of Sperner’s
Lemma
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
We apply Sperner’s lemma to the subdivided complex
• By Sperner’s Lemma, at least one simplex has all three colours
• This simplex corresponds to an execution where processes decide three distinct values !!!
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
In summary
• The iterated model• Executions are represented as simplicial
complexes• Simple recursive structure
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
In summary
• The set agreement task is impossible to solve [Borowsky & Gafni, Saks & Zaharoglou, Herlihy & Shavit, 93]
• The iterated model is equivalent to the usual read/write model [Borowsky & Gafni, 97]
• Set agreement result is valid in the usual model (but easier to prove in the iterated model)
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
We can enrich the Iterated model with more powerful
objects
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
The safe-consensus task
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
The safe-consensus task[Afek, Gafni & Lieber, 09]
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
Safe-consensus
The safe-consensus task[Afek, Gafni & Lieber, 09]
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
Safe-consensus
2 7 9
Processes start with private input values from a domain I
The safe-consensus task[Afek, Gafni & Lieber, 09]
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
Safe-consensus
2 7 9
2 2 2
Their outputs values must be the same
The safe-consensus task [Afek, Gafni & Lieber, 09]
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
Safe-consensus
2 7 9
The safe-consensus has two special rules
The safe-consensus task [Afek, Gafni & Lieber, 09]
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
Safe-consensus
2 7 9
7
(1) If a process starts executing the task and outputs before any other process starts executing the task
The safe-consensus task [Afek, Gafni & Lieber, 09]
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
Safe-consensus
2 7 9
7 7 7
the task’s output is that process proposed input value.
The safe-consensus task [Afek, Gafni & Lieber, 09]
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
Safe-consensus
2 7 9
(2) Otherwise, if two or more processes initially access the task concurrently
The safe-consensus task [Afek, Gafni & Lieber, 09]
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
Safe-consensus
2 7 9
α α α
it can return any value.(even invalid values)
What happens if we enrich the iterated model with safe-
consensus tasks ?
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
The enriched Modelinit r := 0; sm, input, scret, dec := NULL;
loop foreverr := r + 1;SM[r].write(sm, scret);scret := safe-consensus[h(sm, scret)](id);sm := SM[r].snapshot();
/* Local computing */end loop
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
The enriched Modelinit r := 0; sm, input, scret, dec := NULL;
loop foreverr := r + 1;SM[r].write(sm, scret);scret := safe-consensus[h(sm, scret)](id);sm := SM[r].snapshot();
/* Local computing */end loop
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
Process access the object indicated by h(sm, scret)
What happens to the protocol complex ?
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
Protocol complex with safe-consensus
• 1 round• 3 processes• All processes invoke the
safe-consensus• Input values: Ids
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
A closer look
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
A closer look
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
A closer look
• Which executions are represented in this complex ?
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
A closer look
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
A closer look
• Why do we have only these executions ?
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
A closer look
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
WRSCRD
WRSCRD
WRSCRD
A closer look
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
WRSCRD
WRSCRD
WRSCRD
Safe-consensus =
A closer look
• Executions where the safe-consensus returns green
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
A closer look
• Why there cannot be more adjacent simplexes ?
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
A closer look
• Why there cannot be more adjacent simplexes ?
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
A closer look
• Why there cannot be more adjacent simplexes ?
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
WRSCRD
WRSCRD
WRSCRD
A closer look
• Why there cannot be more adjacent simplexes ?
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
WRSCRD
WRSCRD
WRSCRD
Safe-consensus =
A closer look
• Why there cannot be more adjacent simplexes ?
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
WRSCRD
WRSCRD
WRSCRD
Safe-consensus = Safe-consensus =
A closer look
• Because the safe-consensus does not allow it
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
Safe-consensus = Safe-consensus =
A closer look
• Similar argument for other executions
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
A closer look
• Similary for other executions
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
WRSCRD
WRSCRD
WRSCRD
A closer look
• Similary for other executions
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
WRSCRD
WRSCRD
WRSCRD
Safe-consensus =
A closer look
• Similary for other executions
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
WRSCRD
WRSCRD
WRSCRD
Safe-consensus = Safe-consensus =
A closer look
• Similary for other executions
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
Safe-consensus = Safe-consensus =
A closer look
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
Safe-consensus =
A closer look
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
Safe-consensus =
A closer look
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
Safe-consensus =
And the black complex
• It represents executions where the safe-consensus returns an invalid value
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
And the black complex
• At least two processes invoke the safe-consensus concurrently
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
WRSCRD
WRSCRD
WRSCRD
And the black complex
• At least two processes invoke the safe-consensus concurrently
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
WRSCRD
WRSCRD
WRSCRD
A closer look
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
Safe-consensus = a value different from valid ids
And again…
• Because we work in the iterated model• In the 2nd round• This behaviour is going to repeat
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
Remember, Iterated model
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
Remember, Iterated model
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
Remember, Iterated model
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
Some results for set agreement
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
(k+1,k)-set agreement is solvable in this model
proc (k+1,k)-set-agreement(val)SM.write(val);sc := safe-consensus(id);sm := SM.snapshot();
if (sc is in {1, …, k+1} Λ sm[sc] ≠ NULL) thendec := sm[sc];elsedec := sm[j] with j := min{ m | sm[m] ≠ NULL };end if
decide dec;end proc
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
Notice
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
• We omit here the correctness proof of the protocol
• Not difficult, but tedious
In particular
(3,2)-set agreement is solvable in the iterated model with safe-consensus.
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
In particular
(3,2)-set agreement is solvable in the iterated model with safe-consensus.
But we can prove that
(3,1)-set agreement (3-consensus) is not solvable in the Iterated model with safe-consensus.
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
Proof’s idea• Suppose a protocol exists.• Consider an input where
processes propose their ids• Take the gray subcomplex
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
In the protocol’s 1st round
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
WRSCRD
WRSCRD
WRSCRD
In the protocol’s 1st round
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
WRSCRD
WRSCRD
WRSCRD
In the protocol’s 1st round
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
There exists a path here
In the protocol’s 2nd round
• And because we work in an iterated model
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
2nd round
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
2nd round
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
2nd round
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
2nd round
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
WRSCRD
WRSCRD
WRSCRD
2nd round
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
WRSCRD
WRSCRD
WRSCRD
2nd round
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
There’s also a path
…And so on…
Because of the iterated model
• In any r-round partial execution:– a solo execution of – is “conected” to a execution of and
without
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
When the protocol finishes
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
must decide green
When the protocol finishes
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
must decide red or yellow
must decide green
Contradiction
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
This “connectivity” in all rounds lead us to a
contradiction, so no such protocol can exists
In general
There is no protocol in the Iterated Snapshot model with safe-consensus objects that can solve the (k, 1)-set agreement problem (k ≥ 3).
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
Summary
• There’s a deep conection between Distributed computing and Topology
• Impossibility results arise from this conection• We can derive algorithms by looking at the
geometric structure of protocol complexes• Shared objects can affect the topology of the
protocol complex (safe-consensus)
15/01/2010 Rodolfo Conde and Sergio Rajsbaum
Thank you
15/01/2010 Rodolfo Conde and Sergio Rajsbaum