Calculi for Committed Choices and Compensations Roberto Bruni - Dipartimento di Informatica, Universit - PowerPoint PPT Presentation

About This Presentation
Title:

Calculi for Committed Choices and Compensations Roberto Bruni - Dipartimento di Informatica, Universit

Description:

Title: Formal Models for Distributed Negotiations: From Petri Nets to Join Calculus Author: RB Created Date: 3/26/2003 6:34:17 PM Document presentation format – PowerPoint PPT presentation

Number of Views:102
Avg rating:3.0/5.0
Slides: 132
Provided by: rb764
Category:

less

Transcript and Presenter's Notes

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
2
Motivations
  • 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

3
Motivations
  • 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

4
Compensations
  • 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

5
Compensations 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

6
Approaches
  • 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

7
Flow Composition
A2
A3
A1
A4
A5
8
Transactional Flows
A2
A3
A1
A4
A5
9
Compensation
A2
A3
B2
B3
A1
A4
B1
B4
A5
B5
10
Compensation Flow
11
Nested Flow Diagrams
A2
A3
B2
B3
A1
A4
B1
B4
P
12
Interaction 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)

13
Interacting Transactions

P2
P1

P3

14
Interacting Transactions

P2
P1

P3

15
Interacting Transactions
P3
P2
P1
P2
P3

16
Interacting Transactions
P3
P2
P1
P2
P3

17
Interacting Transactions
P1,P3
P2
P1
P2
P3
P2
18
Outline of the talk
  • Part I
  • Transactional Flows with Compensations
  • Part II
  • A Process Calculus for Distributed Transactions
  • Part III
  • Prototype Implementations

19
Outline of the talk
  • Part I
  • Transactional Flows with Compensations
  • Part II
  • A Process Calculus for Distributed Transactions
  • Part III
  • Prototype Implementations

20
Part I - Flows
  • Sequential Sagas
  • Graphical representation
  • Syntax
  • Big Step Semantics
  • Adequacy results
  • Parallel Sagas
  • Nested Sagas
  • Additional features

21
Flow 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

22
Sequential Sagas Graphically
Accept Order
Update Credit
Prepare Order
Refuse Order
Refund Money
Update Stock
23
Sequential 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
24
Sequential 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
25
Sequential Sagas Semantics
  • An activity A either
  • commits (A ? )
  • aborts (A ? )
  • ? A1 ? ,, An ?

26
Sequential Sagas Semantics
  • A saga S P under ? either
  • commits ( )
  • aborts ( )
  • fails ( )
  • ? is the observable flow

?
? S ??
?
?
? S ??
?
?
? S ??
?

27
Sequential 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
?

28
Sequential Sagas Semantics
?
? ltP,0gt ?? lt , ßgt
?
(saga)
?
? P ??
?
29
Sequential Sagas Semantics
?
? ltP,0gt ?? lt , ßgt
?
(saga)
?
? P ??
?
0
(zero)
? lt0,ßgt ?? lt , ßgt
?
30
Sequential Sagas Semantics
?
? ltP,0gt ?? lt , ßgt
?
(saga)
?
? P ??
?
0
(zero)
? lt0,ßgt ?? lt , ßgt
?
A
(s-act)
A ? , ? ltAB, ßgt ?? lt , Bßgt
?
31
Sequential 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
?

32
Sequential 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
?

33
Sequential Sagas Adequacy
?
and ? A1An
? S ??
?
A1
Aj
Ak
An
34
Sequential Sagas Adequacy
?
and ? A1An
? S ??
?
A1
Aj
Ak
An
?
and ? A1Ak-1Bk-1B1
? S ??
?
A1
Aj
Ak
An
Bj
B1
35
Sequential 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
36
Parallel Sagas Syntax
Update Credit
Refund Money
Accept Order
Refuse Order
Prepare Order
Update Stock
37
Parallel 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
38
Parallel 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
39
Parallel Sagas Naïvely
B1
Bj
Bn
B1
Bj
A1
A2
A1
C1
Ck
Cm
C1
Ck
Cm
A1(B1Bj-1Bj-1B1 C1CmCmC1)A1
40
Parallel 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
41
Parallel 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
?
42
Parallel 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
?
43
Parallel Sagas Semantics
?
?
? ltP,0gt ?? lt ,ßgt
? ltQ,0gt ?? lt ,ßgt
?
?
(s-par)
??
? ltPQ, ßgt ?? lt ,ßß ßgt
?
44
Parallel 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
?
?

?
?
?
?







45
Parallel 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
?
?

?
?
?
?







46
Parallel Sagas Semantics
(f-par)
?1 ? ,
?
?

? ltP,0gt ?? lt?1,0gt
? ltQ,0gt ?? lt?2 ,0gt
?
?
?2 ? , , ,

??
? ltPQ, ßgt ??? lt ?1 ? ?2 , 0gt
?
?

?
?
?
?







47
Parallel Sagas Adequacy
Completion
48
Parallel Sagas Adequacy
Successful Compensation
49
Parallel Sagas Adequacy
Failed Compensation
50
Nested Sagas Graphically
Update Credit
Refund Money
Accept Order
Refuse Order
Prepare Order
Update Stock
Add Points
Subtract Points
51
Nested Sagas Syntax
(Step) X 0 A AB S (Process) P X
PP PP (Saga) S P
52
Nested Sagas Syntax
Update Credit
Refund Money
Accept Order
Refuse Order
Prepare Order
Update Stock
Add Points
Subtract Points
S ? AORO UCRM POUS APSP
53
Nested 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
?

54
Nested 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
?
55
Nested Sagas Adequacy
Completion
56
Nested Sagas Adequacy
Successful Compensation
57
Nested Sagas Adequacy
Failed Compensation
58
More 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

59
Outline of the talk
  • Part I
  • Transactional Flows with Compensations
  • Part II
  • A Process Calculus for Distributed Transactions
  • Part III
  • Prototype Implementations

60
Part II - cJoin
  • Distributed Negotiations
  • CHAM and JOIN
  • cJOIN

61
Distributed Negotiations
  • Negotiations / Contracts
  • commit, abort, compensation
  • hierarchical decisions
  • dynamic membership
  • fully distributed control
  • Process cooperation
  • coordination / orchestration / choreography
  • different platforms and policies

62
Our 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)

63
Why JOIN?
  • Well-known asynchronous calculus
  • process calculus presentation
  • few constructs, based on rendez-vous (atomic
    non-local interactions)
  • basis for distributed programming language

64
Why 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

65
Why 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

66
Chemical 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

67
JOIN 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
68
Join 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

69
Example 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

70
Example 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)

71
Example 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

72
Example 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

73
Example 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

74
Committed 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
75
Committed 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?





76
Committed 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
77
Committed 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
78
Committed 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
79
Committed 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
80
JOIN vs cJOIN
  • PROPOSITION
  • cJOIN is a conservative extension of JOIN

P ?J Q iff P ?cJ Q (for P and Q JOIN processes)
81
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

82
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
83
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
84
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
85
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
86
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
87
Something 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

88
Outline of the talk
  • Part I
  • Transactional Flows with Compensations
  • Part II
  • A Process Calculus for Distributed Transactions
  • Part III
  • Prototype Implementations

89
Part III - Implementation
  • Java Transactional Web Services (JTWS)
  • Java Signal Core Layer (JSCL)
  • Java Transactional Layer (JTL)
  • cJOIN compiler
  • D2PC

90
JTWS 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

91
JTWS 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

92
JTL
  • 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

93
JTL Component Wrappers
In
Out
WS
iRb
oRb
iCt
oCt
94
JTL Transactional Component
In
Out
WS1
links are dynamically established depending on
the internal state
WS2
iRb
oRb
iCt
oCt
WS1 WS2
95
JTL Sequence
In
Out
iRb
oRb
iCt
oCt
JTL1 JTL2
96
JTL Transactional Sequence
In
Out
offer the method addInternalComponent
JTL1 JTL2
97
JTL Trans. Parallel Component
In
Out
offer the method addInternalComponent
JTL1 JTL2
98
Encoding 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

99
Distributed 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

100
D2PC
  • 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

101
Example D2PC
P2
P1
P3
102
Example D2PC

P2
P1
P3
103
Example D2PC

P2
P1

P3
104
Example D2PC

P2
P1

P3

105
Example D2PC

P2
P1

P3

106
Example D2PC
P3
P2
P1
P2
P3

107
Example D2PC
P3
P2
P1
P2
P3

108
Example D2PC
P1,P3
P2
P1
P2
P3
P2
109
Example D2PC
P1,P3
P2
P1
P2
P3
P2
110
Example D2PC
P1,P3
P2
ltP3,P2gt
P1
P2 P2 ()
P3
P2
111
Example D2PC
P1,P3
P2
ltP3,P2gt
P1
P2 P2 ()
P3
P2
112
Example D2PC
P1,P3 P1,P3 ()
P2
ltP3,P2gt
ltP2,P1,P3gt
ltP2,P1,P3gt
P1
P2 P2 ()
P3
P2
113
Example D2PC
P1,P3 P1,P3 ()
P2
ltP3,P2gt
ltP2,P1,P3gt
P1
P2 P2 ()
P3
ltP2,P1,P3gt
P2
114
Example D2PC
P1,P3 P1,P3 (P3)
P2
ltP2,P1,P3gt
P1
P2 P2 ()
P3
ltP2,P1,P3gt
P2
115
Example D2PC
P1,P3 P1,P3 (P3)
P2
ltP2,P1,P3gt
P1
P1,P2 P2 (P2)
P3
P2
116
Example D2PC
P1,P3 P1,P3 (P3)
P2
ltP2,P1,P3gt
P1
P1,P2 P1,P2 (P2)
P3
ltP3,P1,P2gt
P2
117
Example D2PC
P1,P3 P1,P3 (P3)
P2
ltP3,P1,P2gt
ltP2,P1,P3gt
P1
P1,P2 P1,P2 (P2)
P3
P2
118
Example D2PC
P1,P3 P1,P3 (P3)
P2
ltP3,P1,P2gt
ltP2,P1,P3gt
P1
ltP1,P2gt
P1,P2 P1,P2 (P2)
P3
P2 P2 ()
119
Example D2PC
P1,P3 P1,P3 (P3)
P2
ltP1,P2gt
ltP3,P1,P2gt
ltP2,P1,P3gt
P1
P1,P2 P1,P2 (P2)
P3
P2 P2 ()
120
Example D2PC
P1,P3 P1,P3 (P1,P3)
P2
ltP3,P1,P2gt
ltP2,P1,P3gt
P1
P1,P2 P1,P2 (P2)
P3
P2 P2 ()
121
Example D2PC
P1,P3 P1,P3 (P1,P3)
Q2
ltP3,P1,P2gt
ltP2,P1,P3gt
P1
P1,P2 P1,P2 (P2)
P3
P2 P2 ()
122
Example D2PC
P1,P3 P1,P3 (P1,P3)
Q2
ltP3,P1,P2gt
P1
P1,P2 P1,P2 (P2)
P3
P2,P3 P2 (P2)
123
Example 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)
124
Example 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)
125
Example D2PC
P1,P3 P1,P3 (P1,P3)
Q2
P1
P1,P2 P1,P2 (P2)
P3
ltP1,P2,P3gt
P2,P3 P2 ,P3 (P2 ,P3)
126
Example D2PC
P1,P3 P1,P3 (P1,P3)
Q2
P1
P1,P2 P1,P2 (P1,P2)
P3
P2,P3 P2 ,P3 (P2 ,P3)
127
Example D2PC
P1,P3 P1,P3 (P1,P3)
Q2
Q1
P1,P2 P1,P2 (P1,P2)
Q3
P2,P3 P2 ,P3 (P2 ,P3)
128
Final 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

129
Final 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

130
Some 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)

131
JOIN 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
Write a Comment
User Comments (0)
About PowerShow.com