1 Formal Models for Distributed Negotiations Transactions in Linda Roberto Bruni Dipartimento di Informatica Università di Pisa XVII Escuela de Ciencias.

Slides:



Advertisements
Similar presentations
CommUnity, Tiles and Connectors joint work with Roberto Bruni José Luiz Fiadeiro Antónia Lopes Ugo Montanari Ivan Lanese Dipartimento di Informatica Università.
Advertisements

Transaction Management: Concurrency Control CS634 Class 17, Apr 7, 2014 Slides based on “Database Management Systems” 3 rd ed, Ramakrishnan and Gehrke.
Knowledge Based Synthesis of Control for Distributed Systems Doron Peled.
Inference of progress properties for (multi party) sessions Mario Coppo (Universita’ di Torino) joint work with Mariangiola Dezani, Nobuko Yoshida Lisbon,
Introducing Formal Methods, Module 1, Version 1.1, Oct., Formal Specification and Analytical Verification L 5.
Based on: Petri Nets and Industrial Applications: A Tutorial
1.6 Behavioral Equivalence. 2 Two very important concepts in the study and analysis of programs –Equivalence between programs –Congruence between statements.
Transaction Based Modeling and Verification of Hardware Protocols Xiaofang Chen, Steven M. German and Ganesh Gopalakrishnan Supported in part by Intel.
(c) Oded Shmueli Transactions Lecture 1: Introduction (Chapter 1, BHG) Modeling DB Systems.
ESE Einführung in Software Engineering 7. Modeling Behaviour Prof. O. Nierstrasz.
Introduction to Software Engineering 7. Modeling Behaviour.
Chapter 10 What's The Plan?: Algorithmic Thinking.
1 Formal Models for Distributed Negotiations The 2PC in an Extended Pi-Calculus Roberto Bruni Dipartimento di Informatica Università di Pisa XVII Escuela.
© Janice Regan, CMPT 102, Sept CMPT 102 Introduction to Scientific Computer Programming The software development method algorithms.
10. Petri Nets Prof. O. Nierstrasz. Roadmap  Definition: —places, transitions, inputs, outputs —firing enabled transitions  Modelling: —concurrency.
Transaction Processing Lecture ACID 2 phase commit.
1 The SOCK SAGA Ivan Lanese Computer Science Department University of Bologna Italy Joint work with Gianluigi Zavattaro.
1 Ivan Lanese Computer Science Department University of Bologna Roberto Bruni Computer Science Department University of Pisa A mobile calculus with parametric.
1 Formal Models for Distributed Negotiations Description Roberto Bruni Dipartimento di Informatica Università di Pisa XVII Escuela de Ciencias Informaticas.
1 Formal Models for Distributed Negotiations Zero-Safe Nets Roberto Bruni Dipartimento di Informatica Università di Pisa XVII Escuela de Ciencias Informaticas.
Chapter 2: Algorithm Discovery and Design
CP — Concurrent Programming 12. Petri Nets Prof. O. Nierstrasz Wintersemester 2005 / 2006.
1 Formal Models for Distributed Negotiations Workflows, BizTalk and ZSN Roberto Bruni Dipartimento di Informatica Università di Pisa XVII Escuela de Ciencias.
1 Formal Models for Distributed Negotiations Concurrent Languages Translation Roberto Bruni Dipartimento di Informatica Università di Pisa XVII Escuela.
Hernán Melgratti joint work with Roberto Bruni and Ugo Montanari Dipartimento di Informatica - Università di Pisa Flat Committed Join in Join.
1 Formal Models for Distributed Negotiations Committed Join Calculus Roberto Bruni Dipartimento di Informatica Università di Pisa XVII Escuela de Ciencias.
1 Formal Models for Distributed Negotiations Exercises Roberto Bruni Dipartimento di Informatica Università di Pisa XVII Escuela de Ciencias Informaticas.
1 Ivan Lanese Dipartimento di Informatica Università di Pisa Ugo Montanari From Graph Rewriting to Logic Programming joint work with.
1 Static vs dynamic SAGAs Ivan Lanese Computer Science Department University of Bologna/INRIA Italy.
Concurrency. Correctness Principle A transaction is atomic -- all or none property. If it executes partly, an invalid state is likely to result. A transaction,
1 Formal Models for Transactions: Zero Safe Nets Roberto Bruni Dipartimento di Informatica Università di Pisa Models and Languages for Coordination and.
1 Ivan Lanese Computer Science Department University of Bologna Italy Concurrent and located synchronizations in π-calculus.
1 Formal Models for Distributed Negotiations From Petri Nets to Join Calculus Roberto Bruni Dipartimento di Informatica Università di Pisa XVII Escuela.
Operational Semantics Semantics with Applications Chapter 2 H. Nielson and F. Nielson
Chapter 2: Algorithm Discovery and Design
An algebra of Connectors for modeling CommUnity with Tiles joint work with Roberto Bruni Ugo Montanari Dipartimento di Informatica Università di Pisa Ivan.
1 Formal Models for Transactions: BizTalk as ZSN Roberto Bruni Dipartimento di Informatica Università di Pisa Models and Languages for Coordination and.
1 Formal Models for Distributed Negotiations A Calculus of Compensations Roberto Bruni Dipartimento di Informatica Università di Pisa XVII Escuela de Ciencias.
Dipartimento di Informatica Università di Pisa Nested Commits for Mobile Calculi: Extending Join Roberto Bruni, Hernán Melgratti and Ugo Montanari.
Chapter 2: Algorithm Discovery and Design
1 Formal Models for Distributed Negotiations Introduction Roberto Bruni Dipartimento di Informatica Università di Pisa XVII Escuela de Ciencias Informaticas.
Complete Axioms for Stateless Connectors joint work with Roberto Bruni and Ugo Montanari Dipartimento di Informatica Università di Pisa Ivan Lanese Dipartimento.
Memory Consistency Models Some material borrowed from Sarita Adve’s (UIUC) tutorial on memory consistency models.
AN OPTIMISTIC CONCURRENCY CONTROL ALGORITHM FOR MOBILE AD-HOC NETWORK DATABASES Brendan Walker.
© 2009 Matthew J. Sottile, Timothy G. Mattson, and Craig E Rasmussen 1 Concurrency in Programming Languages Matthew J. Sottile Timothy G. Mattson Craig.
Invitation to Computer Science, Java Version, Second Edition.
Distributed Transactions
Ivan Lanese Computer Science Department University of Bologna/INRIA Italy Causal-Consistent Reversibility in a Tuple-Based Language Joint work with Elena.
1 Transaction Management Overview Chapter Transactions  Concurrent execution of user programs is essential for good DBMS performance.  Because.
Dipartimento di Informatica Università di Pisa Alberto Baragatti, Roberto Bruni, Hernán Melgratti, Ugo Montanari and Giorgio Spagnolo Prototype Platforms.
Natallia Kokash (Accepted for PACO’2011) ACG, 31/05/ Input-output conformance testing for channel-based connectors 1.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Fluency with Information Technology Third Edition by Lawrence Snyder Chapter.
Ivan Lanese Computer Science Department University of Bologna/INRIA Italy Decidability Results for Dynamic Installation of Compensation Handlers Joint.
Transactions and Concurrency Control. Concurrent Accesses to an Object Multiple threads Atomic operations Thread communication Fairness.
Transaction Management Overview. Transactions Concurrent execution of user programs is essential for good DBMS performance. – Because disk accesses are.
Object-Oriented Design Concepts University of Sunderland.
Program Correctness. The designer of a distributed system has the responsibility of certifying the correctness of the system before users start using.
1 Controlled concurrency Now we start looking at what kind of concurrency we should allow We first look at uncontrolled concurrency and see what happens.
High Performance Embedded Computing © 2007 Elsevier Lecture 4: Models of Computation Embedded Computing Systems Mikko Lipasti, adapted from M. Schulte.
Francesco Tiezzi IMT Advanced Studies Lucca Causal-Consistent Reversibility in a Tuple-Based Distributed Language Joint work with Elena Giachino, Ivan.
Operational Semantics Mooly Sagiv Tel Aviv University Sunday Scrieber 8 Monday Schrieber.
Operational Semantics Mooly Sagiv Reference: Semantics with Applications Chapter 2 H. Nielson and F. Nielson
An Operational Approach to Relaxed Memory Models
Database Transaction Abstraction I
Event Relation Graphs and Extensions in Ptolemy II
Outline Announcements Fault Tolerance.
Chapter 10: Algorithm TECH Prof. Jeff Cheng.
What's The Plan?: Algorithmic Thinking
What's The Plan?: Algorithmic Thinking
What's The Plan?: Algorithmic Thinking
Presentation transcript:

1 Formal Models for Distributed Negotiations Transactions in Linda Roberto Bruni Dipartimento di Informatica Università di Pisa XVII Escuela de Ciencias Informaticas (ECI 2003), Buenos Aires, July

Formal Models for Distributed Negotiations2 Zero-Safe Approach Zero-Safe nets are based on a two-level classification of resources Stable – Observable – Persistent Zero – Temporary – Volatile This idea can be easily exported from Petri nets to other formalisms whenever States are multisets Elementary actions can fetch and release resources Outcome Express transactions in a concurrent scenario Related refined / abstract views of the same system

Formal Models for Distributed Negotiations3 Adding Transactions to Linda We have already seen net models for Linda Places model messages and processes We can apply the Zero-Safe approach Get some insights on a choice of language primitives for expressing transactions Surprisingly, concurrent semantics is more natural than interleaving semantics Refined / abstract views Problem Linda requires contextual arcs

Formal Models for Distributed Negotiations4 Zero-Safe Nets with Read Arcs The combined use of zero-safe places and read arcs is not problematic Crucial point is whether to forbid or not that a stable token is read (possibly many times) and then also fetched during the same transaction We consider the semantics that forbids these behaviors Regarding read arcs on zero safe places can be dealt with for simplicity and uniformity (see why in a few slides) read arcs on zero safe places are not considered here

Formal Models for Distributed Negotiations5 Zero-Safe Nets with Inhibitor Arcs The combined use of zero-safe places and inhibitor arcs is not completely straightforward We would like to keep consistent refined / abstract views the example above has apparently two independent transactions (s followed by r / just t) they are not really independent because tokens flow in z not reflected in the abstract view Ambiguity solved by restricting inhibitor arcs to stable places only t sr ba cd z

Formal Models for Distributed Negotiations6 Operational Semantics No read arcs on zero safe places (can be relaxed) No inhibitor arcs on zero safe places (avoid ambiguity) (Fix the positive/negative context and do the transaction) if (x  x’)  (u  u’  w  w’  v  v’) =  x  u  x  w  N B v  y x  (u,x)  w  B (v,y) [underlying steps] x  (u,  )  w  B (v,  ) x  u  w  B v [commit] x  (u  w,x)  w  B (v  w,x’) x’  (u’  w,x’)  w  B (v’  w,y)  x  x’  (u  u’  w,x)  w  B (v  v’  w,y) [horizontal composition]

Formal Models for Distributed Negotiations7 From Linda to TraLinda Main ideas: distinguish between low-level and high-level messages Typing relation a:  with  {L,H} atomic prefixing  _C Execute  if the concurrent program C can complete the transaction stable guards only! solve ambiguity in the semantics

Formal Models for Distributed Negotiations8 Syntax Messages M ::=  a:  Action Prefixes  ::= out(a:  ) | rd(a:H) | in(a:  ) | !in(a:  ) Predicates  ::= rdp(a:H) | inp(a:H) Sequential Programs S::= 0 | .C |  ?C:C |  _C Concurrent Programs C ::= S | C|C Processes P ::= M | C | P|P can be relaxed cannot be relaxed

Formal Models for Distributed Negotiations9 Examples in(a:H)_(out(b:H).0 | in(c:H).0) can input the message  a:H  provided that also inputs  c:H  and outputs  b:H  P 1 | … | P n | Q n P i = in(a i :H)_out(z:L).0 Q 0 = Q (generic process) Q i+1 = in(z:L)_Q i can start a task Q after consuming the messages  a 1 :H  …  a n :H  (regardless of the order) in(a:H)_0 deadlock (always abort): should we allow it?

Formal Models for Distributed Negotiations10 Truly Concurrent Semantics for TraLinda Straightforward adaptation of truly concurrent semantics for Linda We must carefully distinguish zero safe places from stable ones Messages  a:H  is stable  a:L  is zero safe Sequential Processes Two versions P is stable _P is zero safe (due to atomic prefixing) Correspondingly, there are two versions of transitions

Formal Models for Distributed Negotiations11 Decomposition Function dec(P) is defined as usual, plus dec(  _P) =  _P In general dec(P) = {P 1,…,P n,M 1,…,M m } We let _dec(P) = {_P 1,…,_P n,M 1,…,M m }

Formal Models for Distributed Negotiations12 Some Transitions See [Bruni, Montanari 2003] for full list and technicalities IN(a, ,P) :    a:   in(a:  ).P  dec(P) ATIN(a, ,P) :    a:   in(a:  )_P  _dec(P) OUT(a, ,P) :   out(a:  ).P   a:   dec(P) ATOUT(a, ,P) :   out(a:  )_P   a:   _dec(P) _IN(a, ,P) :    a:   _in(a:  ).P  dec(P) _ATIN(a, ,P) :    a:   _in(a:  )_P  _dec(P) _OUT(a, ,P) :   _out(a:  ).P   a:   dec(P) _ATOUT(a, ,P) :   _out(a:  )_P   a:   _dec(P)

Formal Models for Distributed Negotiations13 Example: Message Typing out(a:H).Pin(a:H).Q dec(P) … … … dec(Q) …  a:H  out(a:H).P | in(a:H).Q

Formal Models for Distributed Negotiations14 Example: Message Typing out(a:L).P …… in(a:L).Q dec(P) … dec(Q) …  a:L  out(a:L).P | in(a:L).Q

Formal Models for Distributed Negotiations15 Example: Prefixing … in(a:L).out(b:H).P  a:L   b:H  … dec(P) … out(b:H).P

Formal Models for Distributed Negotiations16 Example: Prefixing … in(a:L)_out(b:H).P  a:L   b:H  … dec(P) … _out(b:H).P

Formal Models for Distributed Negotiations17 Example: Prefixing … in(a:L)_out(b:H)_P  a:L   b:H  … _dec(P) … _out(b:H)_P

Formal Models for Distributed Negotiations18 Example: Reading Take the process P = P 1 | P 2 |  a:H  |  b:H  P 1 = rd(a:H)_in(b:H)_out(c:H).0 P 2 = rd(b:H)_in(a:H)_out(c:H).0 Either P 1 or P 2 can be executed successfully, but not both because the messages  a:H  and  b:H  cannot be first read and then consumed during the same transaction Compare against Q = Q 1 | Q 2 |  a:H  |  b:H  Q 1 = rd(a:H).in(b:H).out(c:H).0 Q 2 = rd(b:H).in(a:H).out(c:H).0

Formal Models for Distributed Negotiations19 Example: Reading ……  a:H  … ………  b:H  c:H  0 P1P1 P2P2

Formal Models for Distributed Negotiations20 Some Results For each process P we can construct a finite zero safe net zsnet(P) If P does not contain atomic prefixing The only zero safe places in zsnet(P) are those associated with messages all transactions in zsnet(P) consist of two events at most If P is a Linda process, then zsnet(P)=net(P)

Formal Models for Distributed Negotiations21 A Note on Ordered and Unordered Semantics I Ordered and unordered semantics for Linda have different expressive power (deadlock is decidable in the unordered) In their corresponding net semantics, net O (P) and net U (P), the main difference relies in the atomicity of emission and rendering Take  a  as stable or zero safe We can translate unordered processes in ordered processes via a transformation div(.) div(out(a).P) = out(_a).div(P) | in(_a).out(a).0 div(.) is the identity for the rest

Formal Models for Distributed Negotiations22 A Note on Ordered and Unordered Semantics II Proposition net U (P) is deadlock equivalent to net O (div(P)) (the proof exploits a third net equivalent to both) Atomicity is essential, take div’(out(a).P) = out(_a:L).div’(P) | in(_a:L)_out(a:H).0 div’(.) is the identity for the rest Proposition net O (P) is deadlock equivalent to (the abstract net of) zsnet(div’(P))

Formal Models for Distributed Negotiations23 An Alternative Approach In the context of coordination middlewares JavaSpaces (Sun Microsystem) TSpaces (IBM) Both borrowing features from generative communications of Linda (data-driven coordination) Also event notification (control-driven coordination) Transaction mechanisms Interest on serializability JavaSpaces specifications were not enough precise! [Busi, Zavattaro 2001]

Formal Models for Distributed Negotiations24 Sketch of the Alternative Approach PDL similar to that of Linda New prefixes for transactions create(x) commit(x) New processes  a  T x{P} Interleaving semantics suitable observations Limitations: No nesting, ad-hoc interleaving semantics, monolitic view

Formal Models for Distributed Negotiations25 Principles Data produced within a transaction x will be accessible outside only after the commit of x Data consumption or test for presence within a transaction can operate on local and global items Data tested for presence during a transaction x cannot be consumed by processes outside x Concerning test for absence in a transaction x, if the only occurrences of matching data have been consumed by another transaction, the operation will wait for the commit before reporting the absence of data

Formal Models for Distributed Negotiations26 Improving the Specification “When read, an entry is added to the set of entries read by the provided transaction. Such an entry may be read in any other transaction to which the entry is visible, but cannot be taken” Ok if we do not have conditionals in the language Otherwise, this is not enough for guaranteeing serializability A further lock policy is proposed: “After a test for absence is performed inside a transaction on a certain kind of data, no data of that kind can be introduced in the shared dataspace before the end of the transaction” New processes needed: x{P} R,A to keep track of data removed (R) and tested for absence (A) by x

Formal Models for Distributed Negotiations27 Recap We have seen Transaction primitives for Linda Inspired from zero safe nets Truly concurrent semantics Refined / abstract views Examples Sketch of an alternative approach

Formal Models for Distributed Negotiations28 References Concurrent models for Linda with transactions (Mathematical Structures in Computer Science, 2003, to appear) R. Bruni, U. Montanari On the serializability of transactions in JavaSpaces (Proc. ConCoord’01, ENTCS 54) N. Busi, G. Zavattaro