Title: Nested Commits for Mobile Calculi: Extending Join
 1Nested Commits for Mobile Calculi Extending Join
- Roberto Bruni, HernĂ¡n Melgratti and Ugo Montanari
 
  2Motivation
- 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 
 
  3Committed Join (cJoin)
- Join  primitives for negotiations 
 - Syntax
 
 P,Q  0  x?y?  def D in P  PQ D,E  
J?P  D?E J,K  x?y?  JK
Processes
Definitions
Patterns 
 4Committed Join (cJoin)
- Join  primitives for negotiations 
 - Syntax
 
Messages
M,N  0  x?y?  MN P,Q  0  x?y?  def D 
in P  PQ D,E  J?P  D?E J,K  x?y?  
JK
Processes
Definitions
Patterns 
 5Committed Join (cJoin)
- Join  primitives for negotiations 
 - Syntax
 
Messages
M,N  0  x?y?  MN P,Q  M  def D in P  
PQ D,E  J?P  D?E J,K  x?y?  JK
Processes
Definitions
Patterns 
 6Committed Join (cJoin)
- Join  primitives for negotiations 
 - Syntax
 
Messages
Programmable abort
M,N  0  x?y?  MN P,Q  M  def D in P  
PQ  abort  PQ D,E  J?P  D?E  J?P J,K 
 x?y?  JK
Processes
Definitions
Patterns
Merge definition 
 7Committed Join (cJoin)
- Operational Semantics (CHAM Style)
 
0 ? 
PQ ? P,Q
D?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 
 8Committed Join (cJoin)
- Operational Semantics (CHAM Style)
 
0 ? 
PQ ? P,Q
D?E ? D,E
def D in P ? D?dn(D) , P?dn(D) range(?) fresh
J? P, J? ? J? P, P?
PQ ?  P , ?? Q? 
Contract P evolves in isolation
Compensation Q is kept frozen 
 9Committed Join (cJoin)
- Operational Semantics (CHAM Style)
 
0 ? 
PQ ? P,Q
D?E ? D,E
def D in P ? D?dn(D) , P?dn(D) range(?) fresh
J? P, J? ? J? P, P?
PQ ?  P , ?? Q? 
 Mdef D in 0 ,?? Q?  ? M
Global Resources
Commit 
 10Committed Join (cJoin)
- Operational Semantics (CHAM Style)
 
0 ? 
PQ ? P,Q
D?E ? D,E
def D in P ? D?dn(D) , P?dn(D) range(?) fresh
J? P, J? ? J? P, P?
PQ ?  P , ?? Q? 
 Mdef D in 0 ,?? Q?  ? M
 abort P ,?? Q?  ? Q
Compensation on Abort 
 11Committed Join (cJoin)
- Operational Semantics (CHAM Style)
 
0 ? 
PQ ? P,Q
D?E ? D,E
def D in P ? D?dn(D) , P?dn(D) range(?) fresh
J? P, J? ? J? P, P?
PQ ?  P , ?? Q? 
 Mdef D in 0 ,?? Q?  ? M
 abort P ,?? Q?  ? Q
J1Jn?P, ?i Ji?, Si,?? Qi?  ? J1Jn?P, ?iSi, P?, ? ?iQi?  
Merge n ongoing contracts 
 12Committed Join Features
 M  def D in 0 ,?? Q?  ? M  
 13Committed Join Features
- Commit means termination 
 - Global resources produced inside a negotiation 
are available at commit 
  14Committed Join Features
- Commit means termination 
 - Global resources produced inside a negotiation 
are available at commit  - Explicit abort and compensation
 
 abort  P ,?? Q?  ? Q 
 15Committed 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)  
- ,J1J2 ?P, J1t  P1 Q1, J2t  P2  Q2 ? 
 - ,J1J2 ?P, Pt  P1 P2  Q1  Q2 
 
  16Committed 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 
 
 P1 Q1  P2Q2  Q  
 17Committed 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 
 
 P1 Q1  P2Q2  Q ?  M1  P2Q2  
Q  
 18Committed 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 
 
 P1 Q1  P2Q2  Q ?  M1  P2Q2  
Q ?  M1  M2  Q  
 19Committed 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 
 
 P1 Q1  P2Q2  Q ?  M1  P2Q2  
Q ?  M1  M2  Q ? M1  M2  
 20Committed 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 
 
 P1 Q1  P2Q2  Q ?  abort  P1 
Q1  P2Q2  Q   
 21Committed 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 
 
 P1 Q1  P2Q2  Q ?  abort  P1 
Q1  P2Q2  Q 
 ?  Q1  P2Q2  Q   
 22Committed 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 
 
 P1 Q1  P2Q2  Q ?  abort  P1 
Q1  P2Q2  Q 
 ?  Q1  P2Q2  Q 
 ?  abort  Q1  P2Q2  
Q  
 23Committed 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 
 
 P1 Q1  P2Q2  Q ?  abort  P1 
Q1  P2Q2  Q 
 ?  Q1  P2Q2  Q 
 ?  abort  Q1  P2Q2  
Q ? Q  
 24Example 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? ?   
 25Example 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? ?   
 26Example 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 
 27Example 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? ? 
 28Example 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 
 29Example I Trip Booking II
both needed to commit
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   
 30Example I Trip Booking II
both needed to commit
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 
 31Zero-safe nets
- Synchronization mechanism for transitions 
 - Places are divided in 
 -  Stable Ordinary places 
 -  Zero-safe Idealized resources, invisible to 
external observers  -  
 
  32Zero-safe nets
- Synchronization mechanism for transitions 
 - Places are divided in 
 -  Stable Ordinary places 
 -  Zero-safe Idealized resources, invisible to 
external observers  -  
 
  33Zero-safe nets
- Synchronization mechanism for transitions 
 - Places are divided in 
 -  Stable Ordinary places 
 -  Zero-safe Idealized resources, invisible to 
external observers  -  
 
send
receive 
 34Zero-safe nets
- Synchronization mechanism for transitions 
 - Places are divided in 
 -  Stable Ordinary places 
 -  Zero-safe Idealized resources, invisible to 
external observers  -  
 
send
receive 
 35Zero-safe nets
- Synchronization mechanism for transitions 
 - Places are divided in 
 -  Stable Ordinary places 
 -  Zero-safe Idealized resources, invisible to 
external observers  -  
 
send
receive 
 36Zero-safe nets
- Synchronization mechanism for transitions 
 - Places are divided in 
 -  Stable Ordinary places 
 -  Zero-safe Idealized resources, invisible to 
external observers  -  
 
send
receive 
 37Zero-safe nets Encoding 
- Given a ZS net N(T,S) 
 - Places ports 
 - Transitions firing rules 
 - Tokens messages 
 - Encoding of a marking S 
 - E  E? ? 
 - S1S2  S1  S2 
 
  38Zero-safe nets Encoding
- Encoding of (basic) transitions
 
  39Zero-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 
 40Zero-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   
  41Serializability
- 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  
  42Serializability 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 
 43Serializability
- Serializability as big step reduction relation 
(?) between shallow processes  - Theorem S ?cJ S iff S ? S 
 
  44Final 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