1 formal models for transactions: zero safe nets roberto bruni dipartimento di informatica...
Post on 21-Dec-2015
215 views
TRANSCRIPT
1
Formal Models for Transactions: Zero Safe Nets
Roberto BruniDipartimento di Informatica Università di Pisa
Models and Languages for Coordination and Orchestration
IMT- Institutions Markets Technologies - Alti Studi Lucca
2
Roberto Bruni @ IMT Lucca 13 April 2005
Models and Languages for Coordination and Orchestration
InstitutionsMarketsTechnologies
IMT
Contents Orchestration with Petri Nets Transactions with Zero Safe Nets From BizTalk to Zero Safe Nets
3
Roberto Bruni @ IMT Lucca 13 April 2005
Models and Languages for Coordination and Orchestration
InstitutionsMarketsTechnologies
IMT
Why Extending Petri Nets P/T nets can naturally model
control flow data flow message passing
The basic P/T net model does not offer any synchronization between transitions (only token synchronization)
that would be useful for expressing transactions
4
Roberto Bruni @ IMT Lucca 13 April 2005
Models and Languages for Coordination and Orchestration
InstitutionsMarketsTechnologies
IMT
Why Zero-Safe Nets Zero-Safe Nets offers a basis for modeling
distributed transactions and workflows simple and natural extension of Petri nets based on a concept easily exportable to other
paradigms offering both refined / abstract views admit distributed interpreters / implementations
based on unfolding, no backtracking based on join-calculus
easy to combine with other net flavors (e.g. read arcs)
5
Roberto Bruni @ IMT Lucca 13 April 2005
Models and Languages for Coordination and Orchestration
InstitutionsMarketsTechnologies
IMT
The Idea Zero-Safe Nets are like P/T Petri nets but places
are partitioned in Stable places
ordinary places defining observable states Zero-Safe places (or just zero places)
idealized resources empty in all observable states temporarily used during transactions (coordinating
activities) Transactions as transition synchronizations
a computation from observable states to observable states via non-stable markings
transactions can end when all tokens in zero places have been consumed
6
Roberto Bruni @ IMT Lucca 13 April 2005
Models and Languages for Coordination and Orchestration
InstitutionsMarketsTechnologies
IMT
Rendez-Vous
send receive
The message can be sent
7
Roberto Bruni @ IMT Lucca 13 April 2005
Models and Languages for Coordination and Orchestration
InstitutionsMarketsTechnologies
IMT
Rendez-Vous
send receive
Sender is blocked until message is received
Frozen!
8
Roberto Bruni @ IMT Lucca 13 April 2005
Models and Languages for Coordination and Orchestration
InstitutionsMarketsTechnologies
IMT
Rendez-Vous
send receive
Ready to commit
9
Roberto Bruni @ IMT Lucca 13 April 2005
Models and Languages for Coordination and Orchestration
InstitutionsMarketsTechnologies
IMT
Rendez-Vous
send receive
Coordinated commit
10
Roberto Bruni @ IMT Lucca 13 April 2005
Models and Languages for Coordination and Orchestration
InstitutionsMarketsTechnologies
IMT
Nondeterministic Rendez-Vous
send
receive
receive
11
Roberto Bruni @ IMT Lucca 13 April 2005
Models and Languages for Coordination and Orchestration
InstitutionsMarketsTechnologies
IMT
Origin of the Name In classic Petri net Theory
A place a is n-safe if in any reachable marking it contains at most n tokens
A net is n-safe if all its places are such Thus a place / net is 0-safe if in any reachable
marking it is empty! Useless?
We write zero-safe, not 0-safe Zero places must be empty in any observable
marking
12
Roberto Bruni @ IMT Lucca 13 April 2005
Models and Languages for Coordination and Orchestration
InstitutionsMarketsTechnologies
IMT
From Free-Choice to Non-Deadlocking
turn turn
left leftright right
13
Roberto Bruni @ IMT Lucca 13 April 2005
Models and Languages for Coordination and Orchestration
InstitutionsMarketsTechnologies
IMT
From Free-Choice to Non-Deadlocking
turn turn
left leftright right
14
Roberto Bruni @ IMT Lucca 13 April 2005
Models and Languages for Coordination and Orchestration
InstitutionsMarketsTechnologies
IMT
From Free-Choice to Non-Deadlocking
turn turn
left leftright right
15
Roberto Bruni @ IMT Lucca 13 April 2005
Models and Languages for Coordination and Orchestration
InstitutionsMarketsTechnologies
IMT
From Free-Choice to Non-Deadlocking
turn turn
left leftright right
Success!
16
Roberto Bruni @ IMT Lucca 13 April 2005
Models and Languages for Coordination and Orchestration
InstitutionsMarketsTechnologies
IMT
From Free-Choice to Non-Deadlocking
turn turn
left leftright right
17
Roberto Bruni @ IMT Lucca 13 April 2005
Models and Languages for Coordination and Orchestration
InstitutionsMarketsTechnologies
IMT
From Free-Choice to Non-Deadlocking
turn turn
left leftright right
Deadlock!
18
Roberto Bruni @ IMT Lucca 13 April 2005
Models and Languages for Coordination and Orchestration
InstitutionsMarketsTechnologies
IMT
From Free-Choice to Non-Deadlocking
turn turn
left leftright right
Only successful choicesby design!
19
Roberto Bruni @ IMT Lucca 13 April 2005
Models and Languages for Coordination and Orchestration
InstitutionsMarketsTechnologies
IMT
No Reuse of Stable Tokens Before Commit
send receive
The message can be sent…
20
Roberto Bruni @ IMT Lucca 13 April 2005
Models and Languages for Coordination and Orchestration
InstitutionsMarketsTechnologies
IMT
No Reuse of Stable Tokens Before Commit
send receive
…but no-one can receive it!
21
Roberto Bruni @ IMT Lucca 13 April 2005
Models and Languages for Coordination and Orchestration
InstitutionsMarketsTechnologies
IMT
Multicasting
b
a
z
c
2
new
receive
send
reset copy
22
Roberto Bruni @ IMT Lucca 13 April 2005
Models and Languages for Coordination and Orchestration
InstitutionsMarketsTechnologies
IMT
Multicasting
b
a
z
c
2
new
receive
send
reset copy
23
Roberto Bruni @ IMT Lucca 13 April 2005
Models and Languages for Coordination and Orchestration
InstitutionsMarketsTechnologies
IMT
Multicasting
b
a
z
c
2
new
receive
send
reset copy
24
Roberto Bruni @ IMT Lucca 13 April 2005
Models and Languages for Coordination and Orchestration
InstitutionsMarketsTechnologies
IMT
Multicasting
b
a
z
c
2
new
receive
send
reset copy
25
Roberto Bruni @ IMT Lucca 13 April 2005
Models and Languages for Coordination and Orchestration
InstitutionsMarketsTechnologies
IMT
Multicasting
b
a
z
c
2
new
receive
send
reset copy
26
Roberto Bruni @ IMT Lucca 13 April 2005
Models and Languages for Coordination and Orchestration
InstitutionsMarketsTechnologies
IMT
Formal Definition A Zero-Safe net is
B=(S,T,pre,post,u0,Z) NB=(S,T,pre,post,u0) is the underlying P/T
Petri net ZS is the set of zero places
L=S-Z is the set of stable places u0L is the initial marking
Note: S = (LZ) LZ Markings can be represented as pairs (u,x)
uL
xZ
27
Roberto Bruni @ IMT Lucca 13 April 2005
Models and Languages for Coordination and Orchestration
InstitutionsMarketsTechnologies
IMT
Operational Semantics We can exploit the operational semantics (step
semantics) of the underlying P/T Petri net NB
uxNBvy
(u,x)B(v,y)[underlying steps]
(u,)B(v,)
uBv[commit]
(u,x)B(v,x’) (u’,x’)B(v’,y)
(uu’,x)B(vv’,y)[horizontal composition]
The key feature is horizontal composition• it acts as sequential composition on zero places• it acts as parallel composition on stable places
28
Roberto Bruni @ IMT Lucca 13 April 2005
Models and Languages for Coordination and Orchestration
InstitutionsMarketsTechnologies
IMT
Transactions as Transitions
The admissible behaviors of the net are those that can be committed Such concurrent transactions can be regarded as
atomic activities at the higher level of abstraction In general there can be several P/T Petri nets
N such that N B We should select an abstract net A(B) which
is an ordinary P/T Petri net its places are the stable places of B its transitions are the (minimal) transactions of B
not decomposable in parallel activities all other steps can be inferred
29
Roberto Bruni @ IMT Lucca 13 April 2005
Models and Languages for Coordination and Orchestration
InstitutionsMarketsTechnologies
IMT
Rendez-Vous
send receive
B A(B)
30
Roberto Bruni @ IMT Lucca 13 April 2005
Models and Languages for Coordination and Orchestration
InstitutionsMarketsTechnologies
IMT
From Free-Choice to Non-Deadlocking
turn turn
left leftright right
turn-L turn-R
B A(B)
31
Roberto Bruni @ IMT Lucca 13 April 2005
Models and Languages for Coordination and Orchestration
InstitutionsMarketsTechnologies
IMT
Collective or Individual? Different philosophies can yield different abstract
nets Define an algebra of computations
Careful axiomatization of horizontal composition * Select only those computations such that
goes from stable marking to stable marking If there exist , with = then either = or =
Computations are processes of NB Select only those processes that satisfy suitable conditions
connected – not decomposable in parallel active processes all and only minimal / maximal places stable full – no idle place
CTPh
ITPh
32
Roberto Bruni @ IMT Lucca 13 April 2005
Models and Languages for Coordination and Orchestration
InstitutionsMarketsTechnologies
IMT
Multicasting CTPh
b
a
c
new
1-1reset
2
2
1-2
3
3
1-n
n+1
n+1
… …
Infinitely many transitions!
33
Roberto Bruni @ IMT Lucca 13 April 2005
Models and Languages for Coordination and Orchestration
InstitutionsMarketsTechnologies
IMT
Multicasting ITPh
b
a
c
new
1-1reset
2
2
1-2
3
3
1-n
n+1
n+1
… … 1-n
n+1
n+1
…
Different copy policies are distinguished!Infinitely many transitions!
34
Roberto Bruni @ IMT Lucca 13 April 2005
Models and Languages for Coordination and Orchestration
InstitutionsMarketsTechnologies
IMT
Concurrent Copies
send copy
copy
copy
receive
receive
receive
receive
35
Roberto Bruni @ IMT Lucca 13 April 2005
Models and Languages for Coordination and Orchestration
InstitutionsMarketsTechnologies
IMT
Sequential Copies
send copy
copy
copy
receive
receive
receive
receive
36
Roberto Bruni @ IMT Lucca 13 April 2005
Models and Languages for Coordination and Orchestration
InstitutionsMarketsTechnologies
IMT
The ITPh “Monster”
B CTPh ITPh
2
2
n
n
… …
37
Roberto Bruni @ IMT Lucca 13 April 2005
Models and Languages for Coordination and Orchestration
InstitutionsMarketsTechnologies
IMT
FIFTH HOMEWORK Show that given any Zero Safe net B, we can
always find a corresponding Zero Safe net Bbase
that: Bbase yields the same abstract net as B and Bbase contains only transitions of the form
below:
fork
open join close drop
38
Roberto Bruni @ IMT Lucca 13 April 2005
Models and Languages for Coordination and Orchestration
InstitutionsMarketsTechnologies
IMT
Extensions of Zero-Safe Nets
Read arcs multiple concurrent reading of the same
token Data values
colored tokens / high level nets Dynamic net reconfiguration many others currently under
investigation
39
Roberto Bruni @ IMT Lucca 13 April 2005
Models and Languages for Coordination and Orchestration
InstitutionsMarketsTechnologies
IMT
References Zero-safe nets: comparing the collective
and individual token approaches (Information and Computation 156(1-2):46-89, 2000) R. Bruni, U. Montanari
Extending the zero-safe approach to colored, reconfigurable and dynamic nets (Advances in Petri Nets, LNCS 3098, pp. 321-336, 2002) R. Bruni, H. Melgratti, U. Montanari