Download
nested commits for mobile calculi extending join n.
Skip this Video
Loading SlideShow in 5 Seconds..
Nested Commits for Mobile Calculi: Extending Join PowerPoint Presentation
Download Presentation
Nested Commits for Mobile Calculi: Extending Join

Nested Commits for Mobile Calculi: Extending Join

138 Vues Download Presentation
Télécharger la présentation

Nested Commits for Mobile Calculi: Extending Join

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

  1. Nested Commits for Mobile Calculi: Extending Join Roberto Bruni, Hernán Melgratti and Ugo Montanari

  2. 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 IFIP-TCS 2004, Toulouse, August 21-27 2004

  3. 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 IFIP-TCS 2004, Toulouse, August 21-27 2004

  4. Committed Join (cJoin) • Join + primitives for negotiations • Syntax: Messages 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 IFIP-TCS 2004, Toulouse, August 21-27 2004

  5. Committed Join (cJoin) • Join + primitives for negotiations • Syntax: Messages 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 IFIP-TCS 2004, Toulouse, August 21-27 2004

  6. Negotiation Compensation Committed Join (cJoin) • Join + primitives for negotiations • Syntax: Messages Programmable abort 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 Merge definition IFIP-TCS 2004, Toulouse, August 21-27 2004

  7. Committed Join (cJoin) • Operational Semantics (CHAM Style): heating and cooling reaction IFIP-TCS 2004, Toulouse, August 21-27 2004

  8. Committed Join (cJoin) • Operational Semantics (CHAM Style): Contract P evolves in isolation Compensation Q is kept frozen IFIP-TCS 2004, Toulouse, August 21-27 2004

  9. Committed Join (cJoin) • Operational Semantics (CHAM Style): Global Resources Commit IFIP-TCS 2004, Toulouse, August 21-27 2004

  10. Committed Join (cJoin) • Operational Semantics (CHAM Style): Compensation on Abort IFIP-TCS 2004, Toulouse, August 21-27 2004

  11. Committed Join (cJoin) • Operational Semantics (CHAM Style): Merge n ongoing contracts IFIP-TCS 2004, Toulouse, August 21-27 2004

  12. Committed Join Features • Commit means termination {[ M | def D in 0 , Q ]}  M IFIP-TCS 2004, Toulouse, August 21-27 2004

  13. Committed Join Features • Commit means termination • Global resources produced inside a negotiation are availableat commit IFIP-TCS 2004, Toulouse, August 21-27 2004

  14. Committed Join Features • Commit means termination • Global resources produced inside a negotiation are availableat commit • Explicit abort and compensation {[ abort | P , Q ]}  Q IFIP-TCS 2004, Toulouse, August 21-27 2004

  15. Committed Join Features • Commit means termination • Global resources produced inside a negotiation are availableat commit • Explicit abort and compensation • Cooperation between contracts are given by merging definitions (multiway contracts) …,J1|J2P, [J1t| P1:Q1], [J2t| P2: Q2]  …,J1|J2 P, [Pt|P1| P2: Q1| Q2] IFIP-TCS 2004, Toulouse, August 21-27 2004

  16. Committed Join Features • Commit means termination • Global resources produced inside a negotiation are availableat commit • Explicit abort and compensation • Cooperation between contracts are given by merging definitions (multiway contracts) • Multi-level nesting [ [P1 :Q1] | [P2:Q2] : Q] IFIP-TCS 2004, Toulouse, August 21-27 2004

  17. Committed Join Features • Commit means termination • Global resources produced inside a negotiation are availableat commit • Explicit abort and compensation • Cooperation between contracts are given by merging definitions (multiway contracts) • Multi-level nesting [ [P1 :Q1] | [P2:Q2] : Q] * [ M1 | [P2:Q2] : Q] IFIP-TCS 2004, Toulouse, August 21-27 2004

  18. Committed Join Features • Commit means termination • Global resources produced inside a negotiation are availableat commit • Explicit abort and compensation • Cooperation between contracts are given by merging definitions (multiway contracts) • Multi-level nesting [ [P1 :Q1] | [P2:Q2] : Q] * [ M1 | [P2:Q2] : Q] * [ M1 | M2: Q] IFIP-TCS 2004, Toulouse, August 21-27 2004

  19. Committed Join Features • Commit means termination • Global resources produced inside a negotiation are availableat commit • Explicit abort and compensation • Cooperation between contracts are given by merging definitions (multiway contracts) • Multi-level nesting [ [P1 :Q1] | [P2:Q2] : Q] * [ M1 | [P2:Q2] : Q] * [ M1 | M2 : Q]  M1 | M2 IFIP-TCS 2004, Toulouse, August 21-27 2004

  20. Committed Join Features • Commit means termination • Global resources produced inside a negotiation are availableat commit • Explicit abort and compensation • Cooperation between contracts are given by merging definitions (multiway contracts) • Multi-level nesting [ [P1 :Q1] | [P2:Q2] : Q] * [ [abort | P1’:Q1] | [P2:Q2] : Q] IFIP-TCS 2004, Toulouse, August 21-27 2004

  21. Committed Join Features • Commit means termination • Global resources produced inside a negotiation are availableat commit • Explicit abort and compensation • Cooperation between contracts are given by merging definitions (multiway contracts) • Multi-level nesting [ [P1 :Q1] | [P2:Q2] : Q] * [ [abort | P1’:Q1] | [P2:Q2] : Q]  [ Q1 | [P2:Q2] : Q] IFIP-TCS 2004, Toulouse, August 21-27 2004

  22. Committed Join Features • Commit means termination • Global resources produced inside a negotiation are availableat commit • Explicit abort and compensation • Cooperation between contracts are given by merging definitions (multiway contracts) • Multi-level nesting [ [P1 :Q1] | [P2:Q2] : Q] * [ [abort | P1’:Q1] | [P2:Q2] : Q]  [ Q1| [P2:Q2] : Q] * [ abort | Q1’ | [P2:Q2] : Q] IFIP-TCS 2004, Toulouse, August 21-27 2004

  23. Committed Join Features • Commit means termination • Global resources produced inside a negotiation are availableat commit • Explicit abort and compensation • Cooperation between contracts are given by merging definitions (multiway contracts) • Multi-level nesting [ [P1 :Q1] | [P2:Q2] : Q] * [ [abort | P1’:Q1] | [P2:Q2] : Q]  [ Q1 | [P2:Q2] : Q] * [ abort | Q1’ | [P2:Q2] : Q] Q IFIP-TCS 2004, Toulouse, August 21-27 2004

  24. Example I: Hotel Booking H def WaitBooking   [ def requesto  o$ | price$ price$ | confirmv  BookedRoomv price$  abort inofferingRoom request,confirm : Q ] BookedRoomv  … inWaitBooking  | … IFIP-TCS 2004, Toulouse, August 21-27 2004

  25. Example I: Hotel Booking H def WaitBooking   [ def requesto  o$ | price$ price$ | confirmv  BookedRoomv price$  abort inofferingRoom request,confirm : Q ] BookedRoomv  … inWaitBooking  | … C def BookingHotel   [defhotelMsgr,cdef offer$  cvisa | HotelFound offer$  abort in roffer insearchRoom hotelMsg : Q’ ] inBookingHotel  | … IFIP-TCS 2004, Toulouse, August 21-27 2004

  26. Example I: Hotel Booking H def WaitBooking   [ def requesto  o$ | price$ price$ | confirmv  BookedRoomv price$  abort inofferingRoom request,confirm : Q ] BookedRoomv  … inWaitBooking  | … C def BookingHotel   [defhotelMsgr,cdef offer$  cvisa | HotelFound  offer$  abort in roffer insearchRoom hotelMsg : Q’ ] inBookingHotel  | … HB defsearchRoomhm |offeringRoom r,chmr,c inH | C IFIP-TCS 2004, Toulouse, August 21-27 2004

  27. 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  IFIP-TCS 2004, Toulouse, August 21-27 2004

  28. Example I: Trip Booking I H as before F def WaitBooking    [ def requesto  o$ | price$ price$ | confirmv  BookedFlightv price$  abort inofferingFlight request,confirm : Q ] BookedFlightv  … inWaitBooking   | … local name, different from homonym name in H IFIP-TCS 2004, Toulouse, August 21-27 2004

  29. Example I: Trip Booking II both needed to commit C defhotelOKfc | flightOKhc fc  | hc   BookingHotel  [defhotelMsgr,cdef offer$  cvisa | hotelOKflightConf offer$  abort flightConf HotelFound  in roffer insearchRoom hotelMsg : Q’ ]  BookingFlight [defflightlMsgr,cdef offer$  cvisa | flightOKhotelConf offer$  abort hotelConf FlightFound  in roffer insearchFlight flightMsg : Q’’ ] inBookingHotel | BookingFlight | … IFIP-TCS 2004, Toulouse, August 21-27 2004

  30. Example I: Trip Booking II both needed to commit C defhotelOKfc | flightOKhc fc  | hc   BookingHotel  [defhotelMsgr,cdef offer$  cvisa | hotelOKflightConf offer$  abort flightConf HotelFound  in roffer insearchRoom hotelMsg : Q’ ]  BookingFlight [defflightlMsgr,cdef offer$  cvisa | flightOKhotelConf offer$  abort hotelConf FlightFound  in roffer insearchFlight flightMsg : Q’’ ] inBookingHotel | BookingFlight | … TB def searchRoomhm |offeringRoom r,chmr,c searchFlightfm |offeringFlight r,cfmr,c inH | F | C IFIP-TCS 2004, Toulouse, August 21-27 2004

  31. Zero-safe nets • Synchronization mechanism for transitions • Places are divided in Stable: Ordinary places Zero-safe: Idealized resources, invisible to external observers IFIP-TCS 2004, Toulouse, August 21-27 2004

  32. (Firing) (Step) (Concatenation) (Close) S+Z [  S’+Z’  T (S1,Z1) T (S1’,Z1’) (S2,Z2) T (S2’,Z2’) (S1,Z) T (S1’,Z’’) (S2,Z’’) T (S2’,Z’) (S,) T (S’,) (S+S’’,Z+Z’’) T (S’+S’’,Z’+Z’’) (S1+S2,Z1+Z2) T (S1’+S2’,Z1’ + Z2’) (S1+S2,Z) T (S1’+S2’,Z’) (S,) T (S’,) Zero-safe nets • Synchronization mechanism for transitions • Places are divided in Stable: Ordinary places Zero-safe: Idealized resources, invisible to external observers IFIP-TCS 2004, Toulouse, August 21-27 2004

  33. (Close) (Concatenation) (Step) (Firing) (S,) T (S’,) (S1,Z) T (S1’,Z’’) (S2,Z’’) T (S2’,Z’) (S1,Z1) T (S1’,Z1’) (S2,Z2) T (S2’,Z2’) S+Z [  S’+Z’  T (S+S’’,Z+Z’’) T (S’+S’’,Z’+Z’’) (S1+S2,Z) T (S1’+S2’,Z’) (S,) T (S’,) (S1+S2,Z1+Z2) T (S1’+S2’,Z1’ + Z2’) Zero-safe nets • Synchronization mechanism for transitions • Places are divided in Stable: Ordinary places Zero-safe: Idealized resources, invisible to external observers send receive IFIP-TCS 2004, Toulouse, August 21-27 2004

  34. (Close) (Concatenation) (Step) (Firing) (S,) T (S’,) (S1,Z) T (S1’,Z’’) (S2,Z’’) T (S2’,Z’) (S1,Z1) T (S1’,Z1’) (S2,Z2) T (S2’,Z2’) S+Z [  S’+Z’  T (S+S’’,Z+Z’’) T (S’+S’’,Z’+Z’’) (S1+S2,Z) T (S1’+S2’,Z’) (S,) T (S’,) (S1+S2,Z1+Z2) T (S1’+S2’,Z1’ + Z2’) Zero-safe nets • Synchronization mechanism for transitions • Places are divided in Stable: Ordinary places Zero-safe: Idealized resources, invisible to external observers send receive IFIP-TCS 2004, Toulouse, August 21-27 2004

  35. (Close) (Concatenation) (Step) (Firing) (S,) T (S’,) (S1,Z) T (S1’,Z’’) (S2,Z’’) T (S2’,Z’) (S1,Z1) T (S1’,Z1’) (S2,Z2) T (S2’,Z2’) S+Z [  S’+Z’  T (S+S’’,Z+Z’’) T (S’+S’’,Z’+Z’’) (S1+S2,Z) T (S1’+S2’,Z’) (S,) T (S’,) (S1+S2,Z1+Z2) T (S1’+S2’,Z1’ + Z2’) Zero-safe nets • Synchronization mechanism for transitions • Places are divided in Stable: Ordinary places Zero-safe: Idealized resources, invisible to external observers send receive IFIP-TCS 2004, Toulouse, August 21-27 2004

  36. (Close) (Concatenation) (Step) (Firing) (S,) T (S’,) (S1,Z) T (S1’,Z’’) (S2,Z’’) T (S2’,Z’) (S1,Z1) T (S1’,Z1’) (S2,Z2) T (S2’,Z2’) S+Z [  S’+Z’  T (S+S’’,Z+Z’’) T (S’+S’’,Z’+Z’’) (S1+S2,Z) T (S1’+S2’,Z’) (S,) T (S’,) (S1+S2,Z1+Z2) T (S1’+S2’,Z1’ + Z2’) Zero-safe nets • Synchronization mechanism for transitions • Places are divided in Stable: Ordinary places Zero-safe: Idealized resources, invisible to external observers send receive IFIP-TCS 2004, Toulouse, August 21-27 2004

  37. 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  [[S1+S2]] ::= [[S1]] | [[S2]] IFIP-TCS 2004, Toulouse, August 21-27 2004

  38. E e1 e e e e1 e2 open calc fork fork close drop e2 e1 e2 e e E Zero-safe nets: Encoding • Encoding of (basic) transitions IFIP-TCS 2004, Toulouse, August 21-27 2004

  39. E e1 e e e e1 e2 open calc fork fork close drop e2 e1 e2 e e E Zero-safe nets: Encoding • Encoding of (basic) transitions E  [ def z   0 in ez : E ] e1z e2z ez e1z | e2z e1z1 | e2z2  ez1 ez E  ez 0 IFIP-TCS 2004, Toulouse, August 21-27 2004

  40. Zero-safe nets: Encoding • cJoin process for a ZS net Let N=(T,S) be a ZS net, PN = def [[ T ]] in [[ S ]] • Theorem Let N=(T,S) be a ZS net. (S,) * (S’,) iff def [[T]] in [[S]] * def [[T]] in [[S’]] IFIP-TCS 2004, Toulouse, August 21-27 2004

  41. 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 IFIP-TCS 2004, Toulouse, August 21-27 2004

  42. nest( 0 ) = nest( abort ) = nest( xŷ ) = 0 nest( def DinP ) = nest(P ) nest( [ P : Q ]) = nest(P ) + 1 nest( P | Q ) = max{nest( P ), nest(Q )} 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 D = JP, where nest(P ) = 0, or P = [ R : Q ] and nest( R | Q ) = 0 D = J P, and nest(P ) = 0 IFIP-TCS 2004, Toulouse, August 21-27 2004

  43. (Global Firing) (Abort) (Local Commit) (Idle) D ├ [abort | P : S]  D ├ S D  J P├ J D  J  P├ P D ├ P  D ├ P D ├ [M | D’ ├ 0 : S]  D ├ M (Seq) (Local Firing) (Par) D ├ P  D ├ P’’ D ├ P’’  D ├ P’ |B|├ S  |B|├ S’ D ├ P  D ├ P’ D ├ Q  D ├ Q’ (Merge) D ├ P | Q  D ├ P’ | Q’ D  B ├ [S : Q]  D  B ├ [S’ : Q] D ├ P  D ├ P’ D iJiS├ I [ Di├ Ji| Si : Qi]  D I JiS├ [iDi├ I Si | S: I Qi] Serializability • Serializability as big step reduction relation () between shallow processes • Theorem: S *cJ S’ iff S  S’ IFIP-TCS 2004, Toulouse, August 21-27 2004

  44. 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 IFIP-TCS 2004, Toulouse, August 21-27 2004