Presentation is loading. Please wait.

Presentation is loading. Please wait.

Dipartimento di Informatica Università di Pisa Nested Commits for Mobile Calculi: Extending Join Roberto Bruni, Hernán Melgratti and Ugo Montanari.

Similar presentations


Presentation on theme: "Dipartimento di Informatica Università di Pisa Nested Commits for Mobile Calculi: Extending Join Roberto Bruni, Hernán Melgratti and Ugo Montanari."— Presentation transcript:

1 Dipartimento di Informatica Università di Pisa Nested Commits for Mobile Calculi: Extending Join Roberto Bruni, Hernán Melgratti and Ugo Montanari

2 Hernán Melgratti Università di Pisa IFIP-TCS 2004, Toulouse, August 21-27 2004 Motivation To develop a process description language with primitives for agreements or negotiations Multiway (several parties can start separately but commit on reached agreement) Non-perfect compensations (certain actions cannot be undone) Programmable abort / compensation Different levels of abstraction

3 Hernán Melgratti Università di Pisa IFIP-TCS 2004, Toulouse, August 21-27 2004 Committed Join (cJoin) Join + primitives for negotiations Syntax: P,Q ::= 0 | x  ŷ  | def D in P | P|Q D,E ::= J  P | D  E J,K ::= x  ŷ  | J|K Processes Definitions Patterns

4 Hernán Melgratti Università di Pisa IFIP-TCS 2004, Toulouse, August 21-27 2004 Committed Join (cJoin) Join + primitives for negotiations Syntax: M,N ::= 0 | x  ŷ  | M|N P,Q ::= 0 | x  ŷ  | def D in P | P|Q D,E ::= J  P | D  E J,K ::= x  ŷ  | J|K Processes Definitions Patterns Messages

5 Hernán Melgratti Università di Pisa IFIP-TCS 2004, Toulouse, August 21-27 2004 Committed Join (cJoin) Join + primitives for negotiations Syntax: M,N ::= 0 | x  ŷ  | M|N P,Q ::= M | def D in P | P|Q D,E ::= J  P | D  E J,K ::= x  ŷ  | J|K Processes Definitions Patterns Messages

6 Hernán Melgratti Università di Pisa IFIP-TCS 2004, Toulouse, August 21-27 2004 Committed Join (cJoin) Join + primitives for negotiations Syntax: M,N ::= 0 | x  ŷ  | M|N P,Q ::= M | def D in P | P|Q | abort | [P:Q] D,E ::= J  P | D  E | J  P J,K ::= x  ŷ  | J|K Processes Definitions Patterns Programmable abort Negotiation Compensation Merge definition Messages

7 Hernán Melgratti Università di Pisa IFIP-TCS 2004, Toulouse, August 21-27 2004 Committed Join (cJoin) Operational Semantics (CHAM Style): 0  P|Q  P,Q DEDE  D,E def D in P  D  dn(D), P  dn(D) range(  ) fresh J  P, J   J  P, P  heating and cooling reaction

8 Hernán Melgratti Università di Pisa IFIP-TCS 2004, Toulouse, August 21-27 2004 Committed Join (cJoin) Operational Semantics (CHAM Style): 0  P|Q  P,Q DEDE  D,E def D in P  D  dn(D), P  dn(D) range(  ) fresh J  P, J   J  P, P  [P:Q]  {[ P,   Q  ]} Contract P evolves in isolation Compensation Q is kept frozen

9 Hernán Melgratti Università di Pisa IFIP-TCS 2004, Toulouse, August 21-27 2004 Committed Join (cJoin) Operational Semantics (CHAM Style): 0  P|Q  P,Q DEDE  D,E def D in P  D  dn(D), P  dn(D) range(  ) fresh J  P, J   J  P, P  [P:Q]  {[ P,   Q  ]} {[ M|def D in 0,   Q  ]}  M Global Resources Commit

10 Hernán Melgratti Università di Pisa IFIP-TCS 2004, Toulouse, August 21-27 2004 Committed Join (cJoin) Operational Semantics (CHAM Style): 0  P|Q  P,Q DEDE  D,E def D in P  D  dn(D), P  dn(D) range(  ) fresh J  P, J   J  P, P  [P:Q]  {[ P,   Q  ]} {[ M|def D in 0,   Q  ]}  M {[ abort |P,   Q  ]}  Q Compensation on Abort

11 Hernán Melgratti Università di Pisa IFIP-TCS 2004, Toulouse, August 21-27 2004 Committed Join (cJoin) Operational Semantics (CHAM Style): 0  P|Q  P,Q DEDE  D,E def D in P  D  dn(D), P  dn(D) range(  ) fresh J  P, J   J  P, P  [P:Q]  {[ P,   Q  ]} {[ M|def D in 0,   Q  ]}  M {[ abort |P,   Q  ]}  Q J 1 |…|J n  P,  i {[ J i , S i,   Q i  ]}  J 1 |…|J n  P, {[  i S i, P ,   i Q i  ]} Merge n ongoing contracts

12 Hernán Melgratti Università di Pisa IFIP-TCS 2004, Toulouse, August 21-27 2004 {[ M | def D in 0,   Q  ]}  M Committed Join Features Commit means termination

13 Hernán Melgratti Università di Pisa IFIP-TCS 2004, Toulouse, August 21-27 2004 Committed Join Features Commit means termination Global resources produced inside a negotiation are available at commit

14 Hernán Melgratti Università di Pisa IFIP-TCS 2004, Toulouse, August 21-27 2004 Committed Join Features Commit means termination Global resources produced inside a negotiation are available at commit Explicit abort and compensation {[ abort | P,   Q  ]}  Q

15 Hernán Melgratti Università di Pisa IFIP-TCS 2004, Toulouse, August 21-27 2004 Committed Join Features Commit means termination Global resources produced inside a negotiation are available at commit Explicit abort and compensation Cooperation between contracts are given by merging definitions (multiway contracts) …,J 1 |J 2  P, [J 1  | P 1  :Q 1 ], [J 2  | P 2  : Q 2 ]  …,J 1 |J 2  P, [P  | P 1 | P 2  : Q 1 | Q 2 ]

16 Hernán Melgratti Università di Pisa IFIP-TCS 2004, Toulouse, August 21-27 2004 Committed Join Features Commit means termination Global resources produced inside a negotiation are available at commit Explicit abort and compensation Cooperation between contracts are given by merging definitions (multiway contracts) Multi-level nesting [ [P 1 :Q 1 ] | [P 2 :Q 2 ] : Q]

17 Hernán Melgratti Università di Pisa IFIP-TCS 2004, Toulouse, August 21-27 2004 Committed Join Features Commit means termination Global resources produced inside a negotiation are available at commit Explicit abort and compensation Cooperation between contracts are given by merging definitions (multiway contracts) Multi-level nesting [ [P 1 :Q 1 ] | [P 2 :Q 2 ] : Q]  * [ M 1 | [P 2 :Q 2 ] : Q]

18 Hernán Melgratti Università di Pisa IFIP-TCS 2004, Toulouse, August 21-27 2004 Committed Join Features Commit means termination Global resources produced inside a negotiation are available at commit Explicit abort and compensation Cooperation between contracts are given by merging definitions (multiway contracts) Multi-level nesting [ [P 1 :Q 1 ] | [P 2 :Q 2 ] : Q]  * [ M 1 | [P 2 :Q 2 ] : Q]  * [ M 1 | M 2 : Q]

19 Hernán Melgratti Università di Pisa IFIP-TCS 2004, Toulouse, August 21-27 2004 Committed Join Features Commit means termination Global resources produced inside a negotiation are available at commit Explicit abort and compensation Cooperation between contracts are given by merging definitions (multiway contracts) Multi-level nesting [ [P 1 :Q 1 ] | [P 2 :Q 2 ] : Q]  * [ M 1 | [P 2 :Q 2 ] : Q]  * [ M 1 | M 2 : Q]  M 1 | M 2

20 Hernán Melgratti Università di Pisa IFIP-TCS 2004, Toulouse, August 21-27 2004 Committed Join Features Commit means termination Global resources produced inside a negotiation are available at commit Explicit abort and compensation Cooperation between contracts are given by merging definitions (multiway contracts) Multi-level nesting [ [P 1 :Q 1 ] | [P 2 :Q 2 ] : Q]  * [ [abort | P 1 ’ :Q 1 ] | [P 2 :Q 2 ] : Q]

21 Hernán Melgratti Università di Pisa IFIP-TCS 2004, Toulouse, August 21-27 2004 Committed Join Features Commit means termination Global resources produced inside a negotiation are available at commit Explicit abort and compensation Cooperation between contracts are given by merging definitions (multiway contracts) Multi-level nesting [ [P 1 :Q 1 ] | [P 2 :Q 2 ] : Q]  * [ [abort | P 1 ’ :Q 1 ] | [P 2 :Q 2 ] : Q]  [ Q 1 | [P 2 :Q 2 ] : Q]

22 Hernán Melgratti Università di Pisa IFIP-TCS 2004, Toulouse, August 21-27 2004 Committed Join Features Commit means termination Global resources produced inside a negotiation are available at commit Explicit abort and compensation Cooperation between contracts are given by merging definitions (multiway contracts) Multi-level nesting [ [P 1 :Q 1 ] | [P 2 :Q 2 ] : Q]  * [ [abort | P 1 ’ :Q 1 ] | [P 2 :Q 2 ] : Q]  [ Q 1 | [P 2 :Q 2 ] : Q]  * [ abort | Q 1 ’ | [P 2 :Q 2 ] : Q]

23 Hernán Melgratti Università di Pisa IFIP-TCS 2004, Toulouse, August 21-27 2004 Committed Join Features Commit means termination Global resources produced inside a negotiation are available at commit Explicit abort and compensation Cooperation between contracts are given by merging definitions (multiway contracts) Multi-level nesting [ [P 1 :Q 1 ] | [P 2 :Q 2 ] : Q]  * [ [abort | P 1 ’ :Q 1 ] | [P 2 :Q 2 ] : Q]  [ Q 1 | [P 2 :Q 2 ] : Q]  * [ abort | Q 1 ’ | [P 2 :Q 2 ] : Q]  Q

24 Hernán Melgratti Università di Pisa IFIP-TCS 2004, Toulouse, August 21-27 2004 Example I: Hotel Booking H  def WaitBooking    [ def request  o   o  $  | price  $   price  $  | confirm  v   BookedRoom  v   price  $   abort in offeringRoom  request,confirm  : Q ]  BookedRoom  v   … in WaitBooking   | …

25 Hernán Melgratti Università di Pisa IFIP-TCS 2004, Toulouse, August 21-27 2004 Example I: Hotel Booking H  def WaitBooking    [ def request  o   o  $  | price  $   price  $  | confirm  v   BookedRoom  v   price  $   abort in offeringRoom  request,confirm  : Q ]  BookedRoom  v   … in WaitBooking   | … C  def BookingHotel    [def hotelMsg  r,c   def offer  $   c  visa  | HotelFound  offer  $   abort in r  offer  in searchRoom  hotelMsg  : Q’ ] in BookingHotel   | …

26 Hernán Melgratti Università di Pisa IFIP-TCS 2004, Toulouse, August 21-27 2004 Example I: Hotel Booking H  def WaitBooking    [ def request  o   o  $  | price  $   price  $  | confirm  v   BookedRoom  v   price  $   abort in offeringRoom  request,confirm  : Q ]  BookedRoom  v   … in WaitBooking   | … C  def BookingHotel    [def hotelMsg  r,c   def offer  $   c  visa  | HotelFound    offer  $   abort in r  offer  in searchRoom  hotelMsg  : Q’ ] in BookingHotel   | … HB  def searchRoom  hm  | offeringRoom  r,c   hm  r,c  in H | C

27 Hernán Melgratti Università di Pisa IFIP-TCS 2004, Toulouse, August 21-27 2004 Example I: Hotel Booking …, WaitBooking  , BookingHotel     …, […, offeringRoom  request,confirm  : Q ], […, searchRoom  hotelMsg  : Q’]  …, […, hotelMsg  request,confirm  : Q | Q’]  …, […, request  offer  : Q | Q’]  …, […, offer  $ , price  $  : Q | Q’]  …, […, confirm  visa , HotelFound, price  $  : Q | Q’]  …, […, BookedRoom  visa , HotelFound   : Q | Q’]  …, BookedRoom  visa , HotelFound  

28 Hernán Melgratti Università di Pisa IFIP-TCS 2004, Toulouse, August 21-27 2004 Example I: Trip Booking I H as before F  def WaitBooking    [ def request  o   o  $  | price  $   price  $  | confirm  v   BookedFlight  v   price  $   abort in offeringFlight  request,confirm  : Q ]  BookedFlight  v   … in WaitBooking   | … local name, different from homonym name in H

29 Hernán Melgratti Università di Pisa IFIP-TCS 2004, Toulouse, August 21-27 2004 Example I: Trip Booking II C  def hotelOK  fc  | flightOK  hc   fc   | hc    BookingHotel    [def hotelMsg  r,c   def offer  $   c  visa  | hotelOK  flightConf   offer  $   abort  flightConf  HotelFound   in r  offer  in searchRoom  hotelMsg  : Q’ ]  BookingFlight    [def flightlMsg  r,c   def offer  $   c  visa  | flightOK  hotelConf   offer  $   abort  hotelConf  FlightFound   in r  offer  in searchFlight  flightMsg  : Q’’ ] in BookingHotel | BookingFlight | … both needed to commit

30 Hernán Melgratti Università di Pisa IFIP-TCS 2004, Toulouse, August 21-27 2004 Example I: Trip Booking II C  def hotelOK  fc  | flightOK  hc   fc   | hc    BookingHotel    [def hotelMsg  r,c   def offer  $   c  visa  | hotelOK  flightConf   offer  $   abort  flightConf  HotelFound   in r  offer  in searchRoom  hotelMsg  : Q’ ]  BookingFlight    [def flightlMsg  r,c   def offer  $   c  visa  | flightOK  hotelConf   offer  $   abort  hotelConf  FlightFound   in r  offer  in searchFlight  flightMsg  : Q’’ ] in BookingHotel | BookingFlight | … TB  def searchRoom  hm  | offeringRoom  r,c   hm  r,c   searchFlight  fm  | offeringFlight  r,c   fm  r,c  in H | F | C both needed to commit

31 Hernán Melgratti Università di Pisa IFIP-TCS 2004, Toulouse, August 21-27 2004 Zero-safe nets Synchronization mechanism for transitions Places are divided in Stable: Ordinary places Zero-safe: Idealized resources, invisible to external observers

32 Hernán Melgratti Università di Pisa IFIP-TCS 2004, Toulouse, August 21-27 2004 Zero-safe nets Synchronization mechanism for transitions Places are divided in Stable: Ordinary places Zero-safe: Idealized resources, invisible to external observers S+Z [  S’+Z’  T (S+S’’,Z+Z’’)  T (S’+S’’,Z’+Z’’) (Firing) (S 1,Z 1 )  T (S 1 ’,Z 1 ’) (S 2,Z 2 )  T (S 2 ’,Z 2 ’) (S 1 +S 2,Z 1 +Z 2 )  T (S 1 ’+S 2 ’,Z 1 ’ + Z 2 ’) (Step) (S 1,Z)  T (S 1 ’,Z’’) (S 2,Z’’)  T (S 2 ’,Z’) (S 1 +S 2,Z)  T (S 1 ’+S 2 ’,Z’) (Concatenation) (S,  )  T (S’,  ) (S,  )  T (S’,  ) (Close)

33 Hernán Melgratti Università di Pisa IFIP-TCS 2004, Toulouse, August 21-27 2004 Zero-safe nets sendreceive Synchronization mechanism for transitions Places are divided in Stable: Ordinary places Zero-safe: Idealized resources, invisible to external observers S+Z [  S’+Z’  T (S+S’’,Z+Z’’)  T (S’+S’’,Z’+Z’’) (Firing) (S 1,Z 1 )  T (S 1 ’,Z 1 ’) (S 2,Z 2 )  T (S 2 ’,Z 2 ’) (S 1 +S 2,Z 1 +Z 2 )  T (S 1 ’+S 2 ’,Z 1 ’ + Z 2 ’) (Step) (S 1,Z)  T (S 1 ’,Z’’) (S 2,Z’’)  T (S 2 ’,Z’) (S 1 +S 2,Z)  T (S 1 ’+S 2 ’,Z’) (Concatenation) (S,  )  T (S’,  ) (S,  )  T (S’,  ) (Close)

34 Hernán Melgratti Università di Pisa IFIP-TCS 2004, Toulouse, August 21-27 2004 Zero-safe nets sendreceive Synchronization mechanism for transitions Places are divided in Stable: Ordinary places Zero-safe: Idealized resources, invisible to external observers S+Z [  S’+Z’  T (S+S’’,Z+Z’’)  T (S’+S’’,Z’+Z’’) (Firing) (S 1,Z 1 )  T (S 1 ’,Z 1 ’) (S 2,Z 2 )  T (S 2 ’,Z 2 ’) (S 1 +S 2,Z 1 +Z 2 )  T (S 1 ’+S 2 ’,Z 1 ’ + Z 2 ’) (Step) (S 1,Z)  T (S 1 ’,Z’’) (S 2,Z’’)  T (S 2 ’,Z’) (S 1 +S 2,Z)  T (S 1 ’+S 2 ’,Z’) (Concatenation) (S,  )  T (S’,  ) (S,  )  T (S’,  ) (Close)

35 Hernán Melgratti Università di Pisa IFIP-TCS 2004, Toulouse, August 21-27 2004 Zero-safe nets sendreceive Synchronization mechanism for transitions Places are divided in Stable: Ordinary places Zero-safe: Idealized resources, invisible to external observers S+Z [  S’+Z’  T (S+S’’,Z+Z’’)  T (S’+S’’,Z’+Z’’) (Firing) (S 1,Z 1 )  T (S 1 ’,Z 1 ’) (S 2,Z 2 )  T (S 2 ’,Z 2 ’) (S 1 +S 2,Z 1 +Z 2 )  T (S 1 ’+S 2 ’,Z 1 ’ + Z 2 ’) (Step) (S 1,Z)  T (S 1 ’,Z’’) (S 2,Z’’)  T (S 2 ’,Z’) (S 1 +S 2,Z)  T (S 1 ’+S 2 ’,Z’) (Concatenation) (S,  )  T (S’,  ) (S,  )  T (S’,  ) (Close)

36 Hernán Melgratti Università di Pisa IFIP-TCS 2004, Toulouse, August 21-27 2004 Zero-safe nets sendreceive Synchronization mechanism for transitions Places are divided in Stable: Ordinary places Zero-safe: Idealized resources, invisible to external observers S+Z [  S’+Z’  T (S+S’’,Z+Z’’)  T (S’+S’’,Z’+Z’’) (Firing) (S 1,Z 1 )  T (S 1 ’,Z 1 ’) (S 2,Z 2 )  T (S 2 ’,Z 2 ’) (S 1 +S 2,Z 1 +Z 2 )  T (S 1 ’+S 2 ’,Z 1 ’ + Z 2 ’) (Step) (S 1,Z)  T (S 1 ’,Z’’) (S 2,Z’’)  T (S 2 ’,Z’) (S 1 +S 2,Z)  T (S 1 ’+S 2 ’,Z’) (Concatenation) (S,  )  T (S’,  ) (S,  )  T (S’,  ) (Close)

37 Hernán Melgratti Università di Pisa IFIP-TCS 2004, Toulouse, August 21-27 2004 Zero-safe nets: Encoding Given a ZS net N=(T,S): Places ports Transitions firing rules Tokens messages Encoding of a marking S: [[E]] ::= E   [[S 1 +S 2 ]] ::= [[S 1 ]] | [[S 2 ]]

38 Hernán Melgratti Università di Pisa IFIP-TCS 2004, Toulouse, August 21-27 2004 Zero-safe nets: Encoding Encoding of (basic) transitions open E e calc e1e1 e2e2 fork e e1e1 e2e2 close e E drop e fork e1e1 e2e2 e

39 Hernán Melgratti Università di Pisa IFIP-TCS 2004, Toulouse, August 21-27 2004 Zero-safe nets: Encoding open E e calc e1e1 e2e2 fork e e1e1 e2e2 close e E drop e fork e1e1 e2e2 e E    [ def z    0 in e  z  : E   ]e1z  e2ze1z  e2z e  z   e 1  z  | e 2  z  e 1  z 1  | e 2  z 2   e  z 1  e  z   E   e  z   0 Encoding of (basic) transitions

40 Hernán Melgratti Università di Pisa IFIP-TCS 2004, Toulouse, August 21-27 2004 Zero-safe nets: Encoding cJoin process for a ZS net Let N=(T,S) be a ZS net, P N = def [[ T ]] in [[ S ]] Theorem Let N=(T,S) be a ZS net. (S,  )  * (S’,  ) iff def [[ T ]] in [[ S ]]  * def [[ T ]] in [[ S’ ]]

41 Hernán Melgratti Università di Pisa IFIP-TCS 2004, Toulouse, August 21-27 2004 Serializability A serializable transaction admits an abstract representation as a single transition cJoin negotiations may interact with other negotiations (not serializable in the previous sense) But all cooperating negotiations can be viewed as a single transition Moreover, we would like this property to hold at every level of nesting

42 Hernán Melgratti Università di Pisa IFIP-TCS 2004, Toulouse, August 21-27 2004 Serializability:Shallowness Shallow processes: any computation increases the height of nesting structure in at most 1 P is shallow if every definition D in P satisfies nest( 0 ) = nest( abort ) = nest( x  ŷ  ) = 0 nest( def D in P ) = nest(P ) nest( [ P : Q ]) = nest(P ) + 1 nest( P | Q ) = max{nest( P ), nest( Q )} D = J  P, where nest(P ) = 0, or P = [ R : Q ] and nest( R | Q ) = 0 D = J  P, and nest(P ) = 0

43 Hernán Melgratti Università di Pisa IFIP-TCS 2004, Toulouse, August 21-27 2004 Serializability Serializability as big step reduction relation (  ) between shallow processes Theorem: S  * cJ S’ iff S  S’ D ├ P  D ├ P’ D ├ Q  D ├ Q’ D ├ P | Q  D ├ P’ | Q’ (Par) D ├ P  D ├ P’’ D ├ P’’  D ├ P’ D ├ P  D ├ P’ (Seq) D  J  P ├ J   D  J  P ├ P  (Global Firing) |B| ├ S  |B| ├ S’ D  B ├ [S : Q]  D  B ├ [S’ : Q] (Local Firing) D   i J i  S ├  I [ D i ├ J i  | S i : Q i ]  D   I J i  S ├ [  i D i ├  I S i | S  :  I Q i ] (Merge) D ├ [M | D’ ├ 0 : S]  D ├ M (Local Commit) D ├ [abort | P : S]  D ├ S (Abort) D ├ P  D ├ P (Idle)

44 Hernán Melgratti Università di Pisa IFIP-TCS 2004, Toulouse, August 21-27 2004 Final Remarks cJoin models multi-way transactions by describing interacting agents but not their global structure Compensations do not undo precommitted activities. Can such compensations be encoded in cJoin? Are cJoin primitives implementable? We plan to use the D2PC protocol The subcalculus of flat processes can be implemented


Download ppt "Dipartimento di Informatica Università di Pisa Nested Commits for Mobile Calculi: Extending Join Roberto Bruni, Hernán Melgratti and Ugo Montanari."

Similar presentations


Ads by Google