3/4/09 Distributed Asynchronous Systems Bertinoro, March 2009 Algorithms Part II 2 • Synchronous – lock‐step synchrony, rounds Distributed Algorithms • computa@on and message delivery • Asynchronous PART II – we lose the no@on of “@me” ASYNCHRONOUS • processes can take any amount of @me in performing computa@on steps SYSTEMS • channels can take any amount of @me in delivering a message • Difficult to deal with – many impossibility results 1 Distributed Asynchronous Model Bertinoro, March 2009 Distributed I/O Automata Model Bertinoro, March 2009 Algorithms Algorithms Part II 3 Part II 4 • Every component of a distributed system is • I/O automaton model described by means of an automaton – a very general model for describing asynchronous systems State (variables) a=1 send( m ) i,j init( v ) i msg=“Hello” • Modular descrip@on recv( m ) j,i – composi@on opera@on Transi:ons (ac:ons) decide( v ) i Send(msg) • can combine automata to create larger automaton Precondi@on: a<5 Effect: a:=a+1 • Invariant asser@ons proofs • I/O – automaton has input and output ac@ons – but also internal ac@ons Distributed I/O Automaton Model Bertinoro, March 2009 Distributed I/O Automaton Model Bertinoro, March 2009 Algorithms Algorithms Part II 5 Part II 6 • Formally, an IOA A consists of 5 components Channel i,j automaton – sig ( A ), set of ac@ons (input, output, internal) Signature: – states ( A ) Input: Output: send ( m ) i,j m ∈ M receive ( m ) i,j m ∈ M • a (not necessarily finite) set of states – start ( A ) States: queue, a FIFO queue of elements of M , ini@ally empty . • a nonempty subset of states ( A ) – trans ( A ), a state‐transi@on func@on Transi:ons: • trans( A ) ⊆ states( A ) × acts ( sig ( A )) × states ( A ) send ( m ) i,j receive ( m ) i,j Ef Effect: fect: add m to queue Pr Precondition econdition: m is first on queue • ∀ state s , input ac@on π , ∃ state s ’ s.t. ( s , π , s ’) ∈ Ef Effect: fect: remove first element of queue trans ( A ) Tasks: – tasks ( A ) { receive(m) i,j : m ∈ M } • equivalence rela@on on “locally controlled” ac@ons of A 1
3/4/09 Distributed I/O Automaton Model Bertinoro, March 2009 Distributed I/O Automaton Model Bertinoro, March 2009 Algorithms Algorithms Part II 7 Part II 8 • Execu@on • Opera@ons on automata – s 0 , π 1 , s 1 , π 2 ,…, s r , π r ,… – Composi@on • ( s k , π k , s k+1 ) is a transi@on of A – Hiding • s 0 is a start state of A • Composi@on • Examples of execu@ons for Channel i,j – A complex automaton described by smaller automata • each describing a simpler piece of the system – Smaller automata combined together α 1 = [ λ ], send(1) i,j ,[1], receive(1) i,j ,[ λ ], send(2) i,j ,[2], receive(2) i,j ,[ λ ] – Ac@ons with same name executed together α 2 = [ λ ], send(1) i,j ,[1], receive(1) i,j ,[ λ ], send(2) i,j ,[2] • only one automaton has “control” of the ac@on • INPUT ac@on of one automaton gets executed when the OUTPUT ac@on with the same name of another automaton α 3 = [ λ ], send(1) i,j ,[1], send(1) i,j ,[11], send(1) i,j ,[111], … gets executed Distributed I/O Automaton Model Bertinoro, March 2009 Distributed I/O Automaton Model Bertinoro, March 2009 Algorithms Algorithms Part II 9 Part II 10 • Now we can compose Channel i,j and p i for every i,j . Process i automaton – when p 1 executes send( m ) 1,2 , channel C 1,2 executes send( m ) 1,2. – when channel C 1,2 executes receive( m ) 1,2 p 2 executes Signature: Input: Output: receive( m ) 1,2 init ( v ) i v ∈ V decide ( v ) i, v ∈ V receive ( m ) j,i m ∈ M, j ≠ i send ( m ) i,j m ∈ M, j ≠ i States: • Internal ac@ons val, a vector indexed by {1,2,…, n } of elements in V ∪ { ⊥ }, all ini@ally ⊥ – are unobservable externally, so they are local and cannot be involved in the composi@on Transi:ons: init ( v ) i, , v ∈ V receive ( v ) J,i, , v ∈ V • to compose two automata, the two sets of internal ac@ons must be fect: val [ i ]= v Ef fect: val [ j ]= v disjoint Ef Effect: Effect: • Output ac@ons send ( v ) i,j , v ∈ V decide ( v ) i , v ∈ V – also disjoint econd: val [ i ]= v econd: ∀ j =1,…,n, val [ j ]≠ ⊥ Pr Precond Pr Precond Ef Effect: fect: none v = f ( val [1],…, val [ n ]) • otherwise two automata “control” the same ac@on; an output ac@on Ef fect: none Effect: can correspond to one (or more) input ac@ons is other automata. • Input ac@ons Tasks: – can be executed at any @me ∀ j ≠ i : { send ( v ) i,j, : v ∈ V } { receive ( v ) i,j, : v ∈ V } Distributed I/O Automaton Model Bertinoro, March 2009 Distributed I/O Automaton Model Bertinoro, March 2009 Algorithms Algorithms Part II 11 Part II 12 init ( v ) 1 decide ( v ) 1 p 1 send ( m ) 1,2 receive ( m ) 3,1 receive ( m ) 2,1 send ( m ) 1,3 p 1 C 3,1 C 1,2 C 1,2 C 1,3 C 3,1 C 2,1 C 2,1 1,3 C init ( v ) 3 decide ( v ) 2 receive ( m ) 1,2 send ( m ) 3,1 C 3,2 p 3 p 2 receive ( m ) 1,3 init ( v ) 2 C 2,3 decide ( v ) 3 send ( m ) 2,1 • Hiding receive ( m ) 3,2 C 3,2 send ( m ) 3,2 p 3 p 2 – we are “hiding” the “output” ac@ons send and receive C 2,3 – those ac@ons are reclassified as internal to A send ( m ) 2,3 receive ( m ) 2,3 2
Recommend
More recommend