Title: Calculi for Committed Choices and Compensations Roberto Bruni - Dipartimento di Informatica, Universit
1 Calculi for Committed Choices and
Compensations Roberto Bruni - Dipartimento
di Informatica, Università di Pisa
Santa Cruz (CA) USA, 18 January 2005
joint work with Gianluigi Ferrari Hernán
Melgratti Ugo Montanari Daniele Strollo Emilio
Tuosto Dip. Informatica, Univ. Pisa
2Motivations
- Design of business processes
- rigorous mathematical foundations
- clean semantics
- expressiveness
- well-disciplined service composition
- modular implementation
- Web Service Composition
- defining complex services as aggregations of
simpler services
3Motivations
- In long lasting negotiations partial agreements
can be reached and locally committed by parties - To be compensated in case of failure
- To be published / confirmed on success
- Formal models are needed
- To discover specification bugs
- To reason rigorously
- To run simulations
- To ease verification
4Compensations
- To Compensate (Merriam-Webster OnLine)
- to neutralize the effect of
- to supply an equivalent to
- to provide with means of counteracting variation
- to offset an error, defect, or undesired effect
- The most important fact
- Compensations have a cost
5Compensations Examples
- Late cancelling of hotel reservations can involve
payment of fees - Failures on credit checks can cause the abort of
parallel activities (which can be partially
completed) e.g. - to unpackage the goods to be sent
- to cancel the courier booking
- Statements of politicians typically require an
unbounded number of nested compensations
6Approaches
- Flow Composition or Hierarchical Patterns
- Similar to workflow systems a process describes
the flow of both control and data among WS - Interaction based Composition, Conversational
Patterns or Global Model - Services describe the ways they can be engaged in
a larger process
7Flow Composition
A2
A3
A1
A4
A5
8Transactional Flows
A2
A3
A1
A4
A5
9Compensation
A2
A3
B2
B3
A1
A4
B1
B4
A5
B5
10Compensation Flow
11Nested Flow Diagrams
A2
A3
B2
B3
A1
A4
B1
B4
P
12Interaction and Agreements
- In commercial applications, separately designed
and implemented components must interact - avoiding ad-hoc proprietary solutions
- offering alternatives to centralized transaction
managers - hiding the coordination layer (separation of
concerns)
13Interacting Transactions
P2
P1
P3
14Interacting Transactions
P2
P1
P3
15Interacting Transactions
P3
P2
P1
P2
P3
16Interacting Transactions
P3
P2
P1
P2
P3
17Interacting Transactions
P1,P3
P2
P1
P2
P3
P2
18Outline of the talk
- Part I
- Transactional Flows with Compensations
- Part II
- A Process Calculus for Distributed Transactions
- Part III
- Prototype Implementations
19Outline of the talk
- Part I
- Transactional Flows with Compensations
- Part II
- A Process Calculus for Distributed Transactions
- Part III
- Prototype Implementations
20Part I - Flows
- Sequential Sagas
- Graphical representation
- Syntax
- Big Step Semantics
- Adequacy results
- Parallel Sagas
- Nested Sagas
- Additional features
21Flow Diagrams and PDLs
- Many PDL proposals to describe business processes
unambiguously - XML-based
- WSFL, XLANG, BPEL4WS,
- Extensions of known calculi
- committed Join (cJOIN), ?t-calculus,
web?-calculus - Flow-based
- Structured Activity Compensation (StAC)
- now evolving to compensating CSP
- core flow language (FL) for sagas BMMPOPL2005
22Sequential Sagas Graphically
Accept Order
Update Credit
Prepare Order
Refuse Order
Refund Money
Update Stock
23Sequential Sagas Syntax
Accept Order
Update Credit
Prepare Order
Refuse Order
Refund Money
Update Stock
(Step) X 0 A AB (Process) P X
PP (Saga) S P
24Sequential Sagas Syntax
Accept Order
Update Credit
Prepare Order
Refuse Order
Refund Money
Update Stock
S AORO UCRM POUS
(Step) X 0 A AB (Process) P X
PP (Saga) S P
25Sequential Sagas Semantics
- An activity A either
- commits (A ? )
- aborts (A ? )
- ? A1 ? ,, An ?
26Sequential Sagas Semantics
- A saga S P under ? either
- commits ( )
- aborts ( )
- fails ( )
- ? is the observable flow
?
? S ??
?
?
? S ??
?
?
? S ??
?
27Sequential Sagas Semantics
- A process P under ? either
- commits (
) - aborts ( )
- fails ( )
- aborts successfully compensated
- ß, ß are the installed compensations
?
? ltP,ßgt ?? lt ,ßgt
?
?
? ltP,ßgt ?? lt , 0gt
?
?
? ltP,ßgt ?? lt , 0gt
?
28Sequential Sagas Semantics
?
? ltP,0gt ?? lt , ßgt
?
(saga)
?
? P ??
?
29Sequential Sagas Semantics
?
? ltP,0gt ?? lt , ßgt
?
(saga)
?
? P ??
?
0
(zero)
? lt0,ßgt ?? lt , ßgt
?
30Sequential Sagas Semantics
?
? ltP,0gt ?? lt , ßgt
?
(saga)
?
? P ??
?
0
(zero)
? lt0,ßgt ?? lt , ßgt
?
A
(s-act)
A ? , ? ltAB, ßgt ?? lt , Bßgt
?
31Sequential Sagas Semantics
?
? ltP,0gt ?? lt , ßgt
?
(saga)
?
? P ??
?
0
(zero)
? lt0,ßgt ?? lt , ßgt
?
A
(s-act)
A ? , ? ltAB, ßgt ?? lt , Bßgt
?
?
? ltß,0gt ?? lt , 0gt
?
(s-cmp)
?
A ? , ? ltAB,ßgt ?? lt , 0gt
?
?
? ltß,0gt ?? lt , 0gt
?
(f-cmp)
?
A ? , ? ltAB,ßgt ?? lt , 0gt
?
32Sequential Sagas Semantics
?
?
? ltQ,ßgt ?? lt ,ßgt
? ltP,ßgt ?? lt ,ßgt
?
?
(s-step)
??
? ltPQ, ßgt ?? lt ,ßgt
?
?
? ltP,ßgt ?? lt , 0gt
?
(a-step)
?
? ltPQ,ßgt ?? lt ,0gt
?
?
? ltP,ßgt ?? lt , 0gt
?
(a-step)
?
? ltPQ,ßgt ?? lt ,0gt
?
33Sequential Sagas Adequacy
?
and ? A1An
? S ??
?
A1
Aj
Ak
An
34Sequential Sagas Adequacy
?
and ? A1An
? S ??
?
A1
Aj
Ak
An
?
and ? A1Ak-1Bk-1B1
? S ??
?
A1
Aj
Ak
An
Bj
B1
35Sequential Sagas Adequacy
?
and ? A1An
? S ??
?
A1
Aj
Ak
An
?
and ? A1Ak-1Bk-1B1
? S ??
?
A1
Aj
Ak
An
Bj
B1
?
and ? A1Ak-1Bk-1Bj1
? S ??
?
A1
Aj
Ak
An
Bj
B1
36Parallel Sagas Syntax
Update Credit
Refund Money
Accept Order
Refuse Order
Prepare Order
Update Stock
37Parallel Sagas Syntax
Update Credit
Refund Money
Accept Order
Refuse Order
Prepare Order
Update Stock
(Step) X 0 A AB (Process) P X PP
PP (Saga) S P
38Parallel Sagas Syntax
Update Credit
Refund Money
Accept Order
Refuse Order
Prepare Order
Update Stock
S AORO UCRM POUS
(Step) X 0 A AB (Process) P X PP
PP (Saga) S P
39Parallel Sagas Naïvely
B1
Bj
Bn
B1
Bj
A1
A2
A1
C1
Ck
Cm
C1
Ck
Cm
A1(B1Bj-1Bj-1B1 C1CmCmC1)A1
40Parallel Sagas Revised
B1
Bj
Bn
B1
Bj
A1
A2
A1
C1
Ck
Cm
C1
Ck
Cm
A1(B1Bj-1Bj-1B1 0)A1
A1(B1Bj-1Bj-1B1 C1C1)A1
A1(B1Bj-1Bj-1B1 C1CmCmC1)A1
41Parallel Sagas Semantics
- A process P under ? either
- commits (
) - aborts ( )
- fails ( )
- is forced to abort (
) - is forced to fail (
) - ? is the observable concurrent flow
?
? ltP,ßgt ?? lt ,ßgt
?
?
? ltP,ßgt ?? lt , 0gt
?
?
? ltP,ßgt ?? lt , 0gt
?
?
? ltP,ßgt ?? lt , 0gt
?
?
? ltP,ßgt ?? lt , 0gt
?
42Parallel Sagas Semantics
?
? ltP,0gt ?? lt?, ßgt
? ? , ,
?
(saga)
?
? P ?? ?
?
?
?
? ltß, 0gt ?? lt , 0gt
(forced-abt)
?
? ltP,ßgt ?? lt ,0gt
?
?
?
? ltß, 0gt ?? lt , 0gt
(forced-abt)
?
? ltP,ßgt ?? lt ,0gt
?
43Parallel Sagas Semantics
?
?
? ltP,0gt ?? lt ,ßgt
? ltQ,0gt ?? lt ,ßgt
?
?
(s-par)
??
? ltPQ, ßgt ?? lt ,ßß ßgt
?
44Parallel Sagas Semantics
(c-par)
?1, ?2 ? ,
?
?
?
? ltP,0gt ?? lt?1,0gt
? ltQ,0gt ?? lt?2,0gt
? ltß,0gt ?? lt ,0gt
?
?
?
?? ?
? ltPQ, ßgt ???? lt ?1 ? ?2 , 0gt
?
?
?
?
?
?
45Parallel Sagas Semantics
(c-par)
?1, ?2 ? ,
?
?
?
? ltP,0gt ?? lt?1,0gt
? ltQ,0gt ?? lt?2,0gt
? ltß,0gt ?? lt ,0gt
?
?
?
?? ?
? ltPQ, ßgt ???? lt ?1 ? ?2 ? , 0gt
?
?
?
?
?
?
46Parallel Sagas Semantics
(f-par)
?1 ? ,
?
?
? ltP,0gt ?? lt?1,0gt
? ltQ,0gt ?? lt?2 ,0gt
?
?
?2 ? , , ,
??
? ltPQ, ßgt ??? lt ?1 ? ?2 , 0gt
?
?
?
?
?
?
47Parallel Sagas Adequacy
Completion
48Parallel Sagas Adequacy
Successful Compensation
49Parallel Sagas Adequacy
Failed Compensation
50Nested Sagas Graphically
Update Credit
Refund Money
Accept Order
Refuse Order
Prepare Order
Update Stock
Add Points
Subtract Points
51Nested Sagas Syntax
(Step) X 0 A AB S (Process) P X
PP PP (Saga) S P
52Nested Sagas Syntax
Update Credit
Refund Money
Accept Order
Refuse Order
Prepare Order
Update Stock
Add Points
Subtract Points
S ? AORO UCRM POUS APSP
53Nested Sagas Semantics
?
? ltP,0gt ?? lt , ßgt
?
(sub-cmt)
?
?
? ltP,ßgt ?? lt , ßßgt
ß acts as default compensation
?
? ltP,0gt ?? lt , 0gt
?
(sub-abt)
?
?
? ltP,ßgt ?? lt , ßgt
?
? ltP,0gt ?? lt , 0gt
?
(sub-fail)
?
? ltP,ßgt ?? lt , 0gt
?
54Nested Sagas Semantics
(sub-forced-1)
?
? ltP,0gt ?? lt , 0gt
?
?
?
? ltP,ßgt ?? lt , 0gt
(sub-forced-2)
?
?
? ltP,0gt ?? lt ,0gt
? ltß,0gt ?? lt ,0gt
?
?
??
? ltP, ßgt ?? lt ,0gt
?
(sub-forced-2)
?
?
? ltP,0gt ?? lt ,0gt
?
? ltß,0gt ?? lt?,0gt
?
?? ,
??
? ltP, ßgt ?? lt ,0gt
?
55Nested Sagas Adequacy
Completion
56Nested Sagas Adequacy
Successful Compensation
57Nested Sagas Adequacy
Failed Compensation
58More on Sagas
- Exception handling try S with P
- Used to catch crashes during backward computation
- Forward recovery strategies try S or P
- Can be used to retry or to improve activities
- Fully programmable compensations SP
- More expressive than default compensation
(sub-cmt) - Allowed by languages like BPEL4WS
- Choices Discriminator P?Q
- Choices Internal P?Q
- Data dependencies A?B
- Valid executions must satisfy dependency
constraints
59Outline of the talk
- Part I
- Transactional Flows with Compensations
- Part II
- A Process Calculus for Distributed Transactions
- Part III
- Prototype Implementations
60Part II - cJoin
- Distributed Negotiations
- CHAM and JOIN
- cJOIN
61Distributed Negotiations
- Negotiations / Contracts
- commit, abort, compensation
- hierarchical decisions
- dynamic membership
- fully distributed control
- Process cooperation
- coordination / orchestration / choreography
- different platforms and policies
62Our Proposal cJOIN
- committed JOIN
- Process Description Language presentation
- Non ACID (unrealistic in highly distributed
systems) - Multiway (several parties can start separately
but commit on reached agreement) - Programmable abort / non-perfect compensation
- Concurrency and distribution (Distributed 2PC)
- Different levels of abstraction (serializability)
63Why JOIN?
- Well-known asynchronous calculus
- process calculus presentation
- few constructs, based on rendez-vous (atomic
non-local interactions) - basis for distributed programming language
64Why JOIN?
- Extends a higher-order functional language
- parallelism in expressions (fork calls)
- parallelism in function patterns (join patterns)
- Distributed implementations
- JoCaml ( http//join.inria.fr )
- Polyphonic C
65Why JOIN?
- Based on an elementary model of concurrency
- the reflexive chemical abstract machine generic
CHAM imposing locality adding reflection - locality only linear reaction patterns allowed
- each molecule or reaction rule is associated to a
single reaction site - reflection reactions can generate new kinds of
molecules together with their defining reaction
rules
66Chemical Abstract Machine
- States are called solutions s
- Multisets of molecules m1,,mn
- data and rules (reflexive CHAM)
- Hierarchical structure via membranes
- Group solutions into molecules
- e.g. s1 , s2 , s3, s4
multiset union
- Evolution (chemical rules)
- Heating / cooling ? (reversible)
- Structural equivalence
- Reactions ?
- Transitions
- Concurrency
67JOIN Calculus in One Slide
- Syntax
- P,Q 0 x?y? def D in P PQ
- D,E J? P D?E
- J,K x?y? JK
- Operational semantics (CHAM Style)
- 0 ?
- PQ ? P,Q
- D?E ? D,E
- def D in P ? D?dn(D) , P?dn(D) (range
?dn(D) globally fresh) - J? P, J? ? J? P, P?
processes
definitions
resembles funct. prog. let f(x)E in F (same
scoping discipline)
patterns
heating and cooling
reaction
68Join calculus vs. ? calculus
- Join is essentially ? with restrictions on
communication patterns - Join combines restriction, reception and
replication in a single receptor definition they
are not available separately - Asynchrony forces us to create and send
continuations in join - Nevertheless, join and asynchronous ? have the
same expressive power - demonstrated by fully abstract encoding in each
direction up to weak barbed congruence
69Example Cell Abstraction
get?k? s?v? ? k?v? s?v?
- A cell s contains the value v
- To get the value
- send a message on port get
- the parameter k is the return address, where the
value v will be sent to
70Example Cell Abstraction
get?k? s?v? ? k?v? s?v?
set?m,k? s?v? ? k?? s?m?
- A cell s contains the value v
- To set the value
- send a message on port set
- the parameter m is the new value for s
- k is the return address (for confirmation)
71Example Cell Abstraction
get?k? s?v? ? k?v? s?v?
def ? in s?n?
set?m,k? s?v? ? k?? s?m?
- The initial value in s is n
- But get, set and s are locally bound by def
- get and set must be extruded, otherwise no one
can use them - instead, s can be kept private
72Example Cell Abstraction
get?k? s?v? ? k?v? s?v?
def ? in s?n? c?get,set?
set?m,k? s?v? ? k?? s?m?
- get, set are extruded on public channel c
- But c should be known only by the owner of the
cell
73Example Cell Abstraction
def create?n,c? ?
in
get?k? s?v? ? k?v? s?v?
def ? in s?n? c?get,set?
set?m,k? s?v? ? k?? s?m?
- A message to create triggers the outermost def
- Three fresh names for s, get and set are
allocated - the initial value of s is the first parameter n
- get and set are sent back to the second argument
c - instead s will never be extruded
- Invariant
- in every configuration there is exactly one
message on s
74Committed JOIN Syntax
messages
- 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
programmable abort
merge definitions (boards) defined boards must
be disjoint from ordinary defined names
75Committed JOIN Semantics
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?
76Committed JOIN Semantics
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?
compensation is kept frozen
contract P can evolve in isolation
77Committed JOIN Semantics
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
commit
global resources
78Committed JOIN Semantics
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
79Committed JOIN Semantics
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, P?, ?iSi, ? ?iQi?
merge n ongoing contracts
80JOIN vs cJOIN
- PROPOSITION
- cJOIN is a conservative extension of JOIN
P ?J Q iff P ?cJ Q (for P and Q JOIN processes)
81Hotel 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
82Hotel 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
83Hotel 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
84Hotel 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
85Trip 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
86Trip 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
87Something About cJOIN
- A simple type system guarantees serializability
for Shallow processes - Proof via correspondence w.r.t. big step
semantics - Commit primitives of cJOIN can be used to
implement committed choices of AKL - explicit encoding of search strategies and
unification via continuation passing and
compensation - Zero-safe nets can also be straightforwardly
encoded as cJOIN processes
88Outline of the talk
- Part I
- Transactional Flows with Compensations
- Part II
- A Process Calculus for Distributed Transactions
- Part III
- Prototype Implementations
89Part III - Implementation
- Java Transactional Web Services (JTWS)
- Java Signal Core Layer (JSCL)
- Java Transactional Layer (JTL)
- cJOIN compiler
- D2PC
90JTWS Methodology
- GOAL Automatic generation of the coordination
code from a description of a composed WS - design as
- well-formed flow diagrams or
- as processes in a suitable language
- automatic generation of coordination wrappers
- for invoking involved services in a sound way
- for managing commitments and compensations
91JTWS and JSCL
- JTWS tailored to long running transactions
- JTWS is based on
- signal exchanges, publish/subscribe, event
notification - JSCL gives a minimal set of functionalities for
- creation/dismissal of new signal types
- signal emitters / handlers as services
- describing connections between components
- asynchronous / synchronous
- typed, peer-to-peer, unidirectional
- broadcast and bidirectional just requires
additional links - management of flow sessions
92JTL
- Specialized kind of JTWS component
- API for (paradigms of) connectors
- only a minimal subset of signals is considered
- three signals can encode compensable transactions
- onInvoke
- onRollBack
- onCommit
93JTL Component Wrappers
In
Out
WS
iRb
oRb
iCt
oCt
94JTL Transactional Component
In
Out
WS1
links are dynamically established depending on
the internal state
WS2
iRb
oRb
iCt
oCt
WS1 WS2
95JTL Sequence
In
Out
iRb
oRb
iCt
oCt
JTL1 JTL2
96JTL Transactional Sequence
In
Out
offer the method addInternalComponent
JTL1 JTL2
97JTL Trans. Parallel Component
In
Out
offer the method addInternalComponent
JTL1 JTL2
98Encoding of cJOIN in JOIN
- Aim
- Define an implementation of cJOIN in JOIN
- Associate to every cJOIN process a JOIN process
that simulate its behavior - Ideas
- Identification of basic forms for definitions
- Definition of a type system to single out
canonical processes - Reuse controllers of the D2PC protocol
99Distributed 2PC (D2PC)
- The Distributed 2PC is a variant of the
decentralized 2PC - When a participant P is ready to commit it has
only a partial knowledge of the whole set of
participants - Only those who directly cooperated with P
- To commit P must contact all its neighbors and
learn the identity of other participants from
them - The D2PC can be conveniently written in Jocaml
100D2PC
- Every participant P acts as coordinator
- During the transaction P builds its own
synchronization set LP of cooperating agents - When P is ready to commit, P asks readiness to
processes in LP (if empty P was isolated and can
commit) - In doing so, P sends them the set LP
- Other participants will send to P
- either a successful reply with their own
synchronization sets - or a failure message
- (in this case, failure is then propagated)
- Successful replies are added to LP
- The protocol terminates when LP is transitively
closed
101Example D2PC
P2
P1
P3
102Example D2PC
P2
P1
P3
103Example D2PC
P2
P1
P3
104Example D2PC
P2
P1
P3
105Example D2PC
P2
P1
P3
106Example D2PC
P3
P2
P1
P2
P3
107Example D2PC
P3
P2
P1
P2
P3
108Example D2PC
P1,P3
P2
P1
P2
P3
P2
109Example D2PC
P1,P3
P2
P1
P2
P3
P2
110Example D2PC
P1,P3
P2
ltP3,P2gt
P1
P2 P2 ()
P3
P2
111Example D2PC
P1,P3
P2
ltP3,P2gt
P1
P2 P2 ()
P3
P2
112Example D2PC
P1,P3 P1,P3 ()
P2
ltP3,P2gt
ltP2,P1,P3gt
ltP2,P1,P3gt
P1
P2 P2 ()
P3
P2
113Example D2PC
P1,P3 P1,P3 ()
P2
ltP3,P2gt
ltP2,P1,P3gt
P1
P2 P2 ()
P3
ltP2,P1,P3gt
P2
114Example D2PC
P1,P3 P1,P3 (P3)
P2
ltP2,P1,P3gt
P1
P2 P2 ()
P3
ltP2,P1,P3gt
P2
115Example D2PC
P1,P3 P1,P3 (P3)
P2
ltP2,P1,P3gt
P1
P1,P2 P2 (P2)
P3
P2
116Example D2PC
P1,P3 P1,P3 (P3)
P2
ltP2,P1,P3gt
P1
P1,P2 P1,P2 (P2)
P3
ltP3,P1,P2gt
P2
117Example D2PC
P1,P3 P1,P3 (P3)
P2
ltP3,P1,P2gt
ltP2,P1,P3gt
P1
P1,P2 P1,P2 (P2)
P3
P2
118Example D2PC
P1,P3 P1,P3 (P3)
P2
ltP3,P1,P2gt
ltP2,P1,P3gt
P1
ltP1,P2gt
P1,P2 P1,P2 (P2)
P3
P2 P2 ()
119Example D2PC
P1,P3 P1,P3 (P3)
P2
ltP1,P2gt
ltP3,P1,P2gt
ltP2,P1,P3gt
P1
P1,P2 P1,P2 (P2)
P3
P2 P2 ()
120Example D2PC
P1,P3 P1,P3 (P1,P3)
P2
ltP3,P1,P2gt
ltP2,P1,P3gt
P1
P1,P2 P1,P2 (P2)
P3
P2 P2 ()
121Example D2PC
P1,P3 P1,P3 (P1,P3)
Q2
ltP3,P1,P2gt
ltP2,P1,P3gt
P1
P1,P2 P1,P2 (P2)
P3
P2 P2 ()
122Example D2PC
P1,P3 P1,P3 (P1,P3)
Q2
ltP3,P1,P2gt
P1
P1,P2 P1,P2 (P2)
P3
P2,P3 P2 (P2)
123Example D2PC
P1,P3 P1,P3 (P1,P3)
Q2
ltP3,P1,P2gt
P1
P1,P2 P1,P2 (P2)
ltP1,P2,P3gt
P3
P2,P3 P2 (P2)
124Example D2PC
P1,P3 P1,P3 (P1,P3)
Q2
ltP3,P1,P2gt
P1
P1,P2 P1,P2 (P2)
P3
ltP1,P2,P3gt
P2,P3 P2 (P2)
125Example D2PC
P1,P3 P1,P3 (P1,P3)
Q2
P1
P1,P2 P1,P2 (P2)
P3
ltP1,P2,P3gt
P2,P3 P2 ,P3 (P2 ,P3)
126Example D2PC
P1,P3 P1,P3 (P1,P3)
Q2
P1
P1,P2 P1,P2 (P1,P2)
P3
P2,P3 P2 ,P3 (P2 ,P3)
127Example D2PC
P1,P3 P1,P3 (P1,P3)
Q2
Q1
P1,P2 P1,P2 (P1,P2)
Q3
P2,P3 P2 ,P3 (P2 ,P3)
128Final Remarks I
- Our definition for compensable flow languages
- abstracts away from low-level computations
- can be easily extended
- independent from the coordination mechanisms that
implement the primitives - Java Transactional Web Services (JTWS)
- Distributed implementation of flows
- Allows to reason about program properties
- Adequacy
- Correctness of implementation
129Final Remarks II
- cJOIN models multi-way transactions by describing
interacting agents but not their global structure - Shallow cJOIN is serializable
- cJOIN primitives are implementable in a
distributed way - at least the subcalculus of flat processes
- D2PC protocol is used
130Some Pointers
- R. Bruni, C. Laneve, U. Montanari
- CONCUR 2002 (D2PC)
- R. Bruni, H. Melgratti, U. Montanari
- POPL 2005 (Flows)
- IFIP TCS 2004 COMETA 2003 (cJOIN)
- Hernán Melgratti
- PhD Thesis submitted (Flows, cJOIN and more)
- Daniele Strollo
- Master Thesis in preparation (JTWS)
131JOIN An Example
received name
- A process P
- P ? z?x,z? def x?y? ? z?y,x? in x?v?
- P as a solution
- z?x,z? , w?y? ? z?y,w? , w?v?
- A reaction
- z?x,z? , w?y? ? z?y,w? , w?v? ?
- z?x,z? , w?y? ? z?y,w? , z?v,w?
bound name
free name
defined name
?-conversion
extrusion