1 where concurrency meets distributed algorithms (for me) joint with: kai engelhardt ron van der...
Post on 18-Dec-2015
216 views
TRANSCRIPT
![Page 1: 1 Where Concurrency meets Distributed Algorithms (for me) Joint with: Kai Engelhardt Ron van der Meyden Yoram Moses Technion EE](https://reader030.vdocuments.us/reader030/viewer/2022032800/56649d255503460f949fb8ab/html5/thumbnails/1.jpg)
1
Where Concurrency meets Distributed Algorithms
(for me)
Joint with:Kai EngelhardtRon van der Meyden
Yoram Moses Technion EE
![Page 2: 1 Where Concurrency meets Distributed Algorithms (for me) Joint with: Kai Engelhardt Ron van der Meyden Yoram Moses Technion EE](https://reader030.vdocuments.us/reader030/viewer/2022032800/56649d255503460f949fb8ab/html5/thumbnails/2.jpg)
2Yoram Moses
Distributed behavior is complex
Rampant nondeterminism: scheduling, timing, reliabilityMultitude of concurrent and co-dependent events Decentralized information and Control
Hence…
![Page 3: 1 Where Concurrency meets Distributed Algorithms (for me) Joint with: Kai Engelhardt Ron van der Meyden Yoram Moses Technion EE](https://reader030.vdocuments.us/reader030/viewer/2022032800/56649d255503460f949fb8ab/html5/thumbnails/3.jpg)
3Yoram Moses
Hence…
Basic tasks are hard to solve Mutual exclusion, Paxos, mail, agreement, voting,
spanning trees… Careful modeling is crucial
For verification, lower bounds
Distributed algorithms literature is fragmented Every interesting task demands significant attention Many different models Problems solved one by one on a per-model basis Similar solutions often repeated in different models “Bottom up” but individual solutions may or may not
be compatible.
![Page 4: 1 Where Concurrency meets Distributed Algorithms (for me) Joint with: Kai Engelhardt Ron van der Meyden Yoram Moses Technion EE](https://reader030.vdocuments.us/reader030/viewer/2022032800/56649d255503460f949fb8ab/html5/thumbnails/4.jpg)
4Yoram Moses
Focus of this talk
Top-Down considerations Refinement Cuts vs. global states
Seq. Composition of distributed algorithms Notions of safe composition Sealing and message reordering
![Page 5: 1 Where Concurrency meets Distributed Algorithms (for me) Joint with: Kai Engelhardt Ron van der Meyden Yoram Moses Technion EE](https://reader030.vdocuments.us/reader030/viewer/2022032800/56649d255503460f949fb8ab/html5/thumbnails/5.jpg)
5Yoram Moses
Main Points
Need tools for abstracting and unifying distributed solutions Both global states and cuts can matter Notions of safe sequential composition are interesting
![Page 6: 1 Where Concurrency meets Distributed Algorithms (for me) Joint with: Kai Engelhardt Ron van der Meyden Yoram Moses Technion EE](https://reader030.vdocuments.us/reader030/viewer/2022032800/56649d255503460f949fb8ab/html5/thumbnails/6.jpg)
6Yoram Moses
Goal No. 1: A Program Refinement Calculus
Desired: A top-down process by which a program is repeatedly replaced by a “more detailed” one, that satisfies the same requirements.
P refines Q if every execution of P is an execution of Q
Refinement for sequential programs is well established Back, Morgan et al.
![Page 7: 1 Where Concurrency meets Distributed Algorithms (for me) Joint with: Kai Engelhardt Ron van der Meyden Yoram Moses Technion EE](https://reader030.vdocuments.us/reader030/viewer/2022032800/56649d255503460f949fb8ab/html5/thumbnails/7.jpg)
7Yoram Moses
set y to max A[1..n]
sort A[1..n]
quicksort[A,n]
y:= A[n] ;
Example
; y:= A[n]
![Page 8: 1 Where Concurrency meets Distributed Algorithms (for me) Joint with: Kai Engelhardt Ron van der Meyden Yoram Moses Technion EE](https://reader030.vdocuments.us/reader030/viewer/2022032800/56649d255503460f949fb8ab/html5/thumbnails/8.jpg)
8Yoram Moses
Programs and Specifications
“Programs” can contain both specifications and concrete
commands Specifications are described using a pair [,] of a pre-
and post-condition, meaning: If started in a state satisfying the program will
terminate, and its final state will satisfy
Reactive behavior can be obtained by temporal statements in spec, and state abstraction by e.g., epistemic statements.
![Page 9: 1 Where Concurrency meets Distributed Algorithms (for me) Joint with: Kai Engelhardt Ron van der Meyden Yoram Moses Technion EE](https://reader030.vdocuments.us/reader030/viewer/2022032800/56649d255503460f949fb8ab/html5/thumbnails/9.jpg)
9Yoram Moses
Refinement Rules
Splitting Rule:[,] ; [ ,] refines [,]
Action Rules: x := 1 refines [true,x=1]
Refinement allows “correctness by design,” maintainability, and design for different models
![Page 10: 1 Where Concurrency meets Distributed Algorithms (for me) Joint with: Kai Engelhardt Ron van der Meyden Yoram Moses Technion EE](https://reader030.vdocuments.us/reader030/viewer/2022032800/56649d255503460f949fb8ab/html5/thumbnails/10.jpg)
10Yoram Moses
Review: Sequential ProgramsExecute between an initial and a final state
Define an (initial/final) relation on states
P
![Page 11: 1 Where Concurrency meets Distributed Algorithms (for me) Joint with: Kai Engelhardt Ron van der Meyden Yoram Moses Technion EE](https://reader030.vdocuments.us/reader030/viewer/2022032800/56649d255503460f949fb8ab/html5/thumbnails/11.jpg)
11Yoram Moses
A Distributed Program
Should execute between distributed states
A specification typically describes assumptions on the initial global state.
P1
P2
![Page 12: 1 Where Concurrency meets Distributed Algorithms (for me) Joint with: Kai Engelhardt Ron van der Meyden Yoram Moses Technion EE](https://reader030.vdocuments.us/reader030/viewer/2022032800/56649d255503460f949fb8ab/html5/thumbnails/12.jpg)
12Yoram Moses
But…
P1
P2
Q2
Q1
Distributed programs terminate along a cut
Even if P starts at a global state, Q will not.
![Page 13: 1 Where Concurrency meets Distributed Algorithms (for me) Joint with: Kai Engelhardt Ron van der Meyden Yoram Moses Technion EE](https://reader030.vdocuments.us/reader030/viewer/2022032800/56649d255503460f949fb8ab/html5/thumbnails/13.jpg)
13Yoram Moses
What is a distributed state?
A sequential state serves two roles: Transformation: Actions modify the
state Control: Programs execute between
statesClaim: In the distributed case Transformation: Actions modify global state Control: Programs execute between cuts
(c1,c2,…,cn) where ci ≤
![Page 14: 1 Where Concurrency meets Distributed Algorithms (for me) Joint with: Kai Engelhardt Ron van der Meyden Yoram Moses Technion EE](https://reader030.vdocuments.us/reader030/viewer/2022032800/56649d255503460f949fb8ab/html5/thumbnails/14.jpg)
14Yoram Moses
Cuts and Specs
Sequential composition amounts to “layering” P*Q:
The cuts on which layers compose are not necessarily consistentThe formulas in a spec [,] become cut formulae.
E.g., “x=0 y=2” , “consistent cut” …What is a good language to express these? (semantics for temporal, epistemic, …)
P Q
![Page 15: 1 Where Concurrency meets Distributed Algorithms (for me) Joint with: Kai Engelhardt Ron van der Meyden Yoram Moses Technion EE](https://reader030.vdocuments.us/reader030/viewer/2022032800/56649d255503460f949fb8ab/html5/thumbnails/15.jpg)
15Yoram Moses
Goal No. 2
Account for both aspects of a distributed state?
Allow for inconsistent cuts
Allow for multiplexing or forking?Havelund et al. 94
![Page 16: 1 Where Concurrency meets Distributed Algorithms (for me) Joint with: Kai Engelhardt Ron van der Meyden Yoram Moses Technion EE](https://reader030.vdocuments.us/reader030/viewer/2022032800/56649d255503460f949fb8ab/html5/thumbnails/16.jpg)
16Yoram Moses
Sequential Composition
Distributed applications often have a sequential structure:
1. Compute MST2. Elect a leader3. Perform a vote using this leader4. Act on the outcome of the vote…
These activities may overlap and interfere.Will individual solutions compose correctly?
![Page 17: 1 Where Concurrency meets Distributed Algorithms (for me) Joint with: Kai Engelhardt Ron van der Meyden Yoram Moses Technion EE](https://reader030.vdocuments.us/reader030/viewer/2022032800/56649d255503460f949fb8ab/html5/thumbnails/17.jpg)
17Yoram Moses
Communication-closed layers
Elrad & Francez 1982, Stomp & de Roever, Janssen Zwiers & Poel, …
Suppose that P= Q*L*R (so each Pi = Qi;Li;Ri ).L is communication-closed (CC) in P if, in all
executions of P, all communication actions in L are internal.
Communication closure in P may depend on all of P
Q L R
![Page 18: 1 Where Concurrency meets Distributed Algorithms (for me) Joint with: Kai Engelhardt Ron van der Meyden Yoram Moses Technion EE](https://reader030.vdocuments.us/reader030/viewer/2022032800/56649d255503460f949fb8ab/html5/thumbnails/18.jpg)
18Yoram Moses
Tail Communication Closure
Program L is TCC if L is communication closed in all programs P = L*Q Gerth and Shrira 86
If L and R are TCC then L*R is TCC. allows incremental CC design
Work on CC and TCC focused on reliable FIFO models. What happens beyond this?
![Page 19: 1 Where Concurrency meets Distributed Algorithms (for me) Joint with: Kai Engelhardt Ron van der Meyden Yoram Moses Technion EE](https://reader030.vdocuments.us/reader030/viewer/2022032800/56649d255503460f949fb8ab/html5/thumbnails/19.jpg)
19Yoram Moses
Example: REL – Reliable non-FIFO channels
Example: 2-process message transmission
In REL&FIFO the program MTij is TCC
Engelhardt & M DISC 2005
![Page 20: 1 Where Concurrency meets Distributed Algorithms (for me) Joint with: Kai Engelhardt Ron van der Meyden Yoram Moses Technion EE](https://reader030.vdocuments.us/reader030/viewer/2022032800/56649d255503460f949fb8ab/html5/thumbnails/20.jpg)
20Yoram Moses
Safe composition in REL
MTij is sealed by MTji : It will not interact with any later layer R.
![Page 21: 1 Where Concurrency meets Distributed Algorithms (for me) Joint with: Kai Engelhardt Ron van der Meyden Yoram Moses Technion EE](https://reader030.vdocuments.us/reader030/viewer/2022032800/56649d255503460f949fb8ab/html5/thumbnails/21.jpg)
21Yoram Moses
More Formally We define a programming language with a “phase” operator
(Q) means Q does not communicate with other layers
A notion of “P executes over” interval r[c,d] A refinement relation ≤ among programs Can define CC and Sealing:
L is a CC in P= Q*L*R: (Q*L*R) ≤ Q*(L)*R
L is TCC : (L*R) ≤ (L)*R for all R
Q seals L: (L*Q*R) ≤ (L)*Q*R for all R
![Page 22: 1 Where Concurrency meets Distributed Algorithms (for me) Joint with: Kai Engelhardt Ron van der Meyden Yoram Moses Technion EE](https://reader030.vdocuments.us/reader030/viewer/2022032800/56649d255503460f949fb8ab/html5/thumbnails/22.jpg)
22Yoram Moses
Sealing
Q seals L if L is a CC in L*Q*R for all R
Sealing allows incremental CC design
Sealing in REL is subtle: No universal seals (barriers) existOnly programs with no reachable communication commands are sealed by the empty programSealing related to Lamport causality
![Page 23: 1 Where Concurrency meets Distributed Algorithms (for me) Joint with: Kai Engelhardt Ron van der Meyden Yoram Moses Technion EE](https://reader030.vdocuments.us/reader030/viewer/2022032800/56649d255503460f949fb8ab/html5/thumbnails/23.jpg)
23Yoram Moses
Transitive Sealing
![Page 24: 1 Where Concurrency meets Distributed Algorithms (for me) Joint with: Kai Engelhardt Ron van der Meyden Yoram Moses Technion EE](https://reader030.vdocuments.us/reader030/viewer/2022032800/56649d255503460f949fb8ab/html5/thumbnails/24.jpg)
24Yoram Moses
An Unsealable Program
Any future communication can interfere
![Page 25: 1 Where Concurrency meets Distributed Algorithms (for me) Joint with: Kai Engelhardt Ron van der Meyden Yoram Moses Technion EE](https://reader030.vdocuments.us/reader030/viewer/2022032800/56649d255503460f949fb8ab/html5/thumbnails/25.jpg)
25Yoram Moses
Getting by with a little help…
Two-process variant of P’ was unsealable
![Page 26: 1 Where Concurrency meets Distributed Algorithms (for me) Joint with: Kai Engelhardt Ron van der Meyden Yoram Moses Technion EE](https://reader030.vdocuments.us/reader030/viewer/2022032800/56649d255503460f949fb8ab/html5/thumbnails/26.jpg)
26Yoram Moses
Sealing and Causality
Thm: Q seals L iff every rcv on a channel ij
in L causally precedes any snd on ij in or after Q (and L can consume all messages it sends)
Prop: A straight-line program has a succinct signaturethat can be used to decide issues of sealing
Thm: If L is sealable then it has a seal that uses O(n) messages (replacing O(n2) acknowledgements)
![Page 27: 1 Where Concurrency meets Distributed Algorithms (for me) Joint with: Kai Engelhardt Ron van der Meyden Yoram Moses Technion EE](https://reader030.vdocuments.us/reader030/viewer/2022032800/56649d255503460f949fb8ab/html5/thumbnails/27.jpg)
27Yoram Moses
Beyond Sealing: Fitting After
Program Q fits after L if layer L never communicates with Q in L*Q:
(L*Q) ≤ (L)*Q
Sealing implies fitting after, but the converse is false. Fitting after allows for incremental CC design. Fitting after is natural in FIFO models (channels are lossy and/or allow duplication) REL is the only imperfect model that does not require headers for composition Fekete and Lynch CONCUR 90, Engelhardt & M 05
![Page 28: 1 Where Concurrency meets Distributed Algorithms (for me) Joint with: Kai Engelhardt Ron van der Meyden Yoram Moses Technion EE](https://reader030.vdocuments.us/reader030/viewer/2022032800/56649d255503460f949fb8ab/html5/thumbnails/28.jpg)
28Yoram Moses
Conclusions
Models of concurrency are crucial for proving properties of programs and lower bounds or impossibility results There is a role for concurrency modeling in top-down design, refinement and the study of compositionality Sequential composition is of interest and has a rich structure