1 formal models for transactions: zero safe nets roberto bruni dipartimento di informatica...

39
1 Formal Models for Transactions: Zero Safe Nets Roberto Bruni Dipartimento di Informatica Università di Pisa Models and Languages for Coordination and Orchestration IMT- Institutions Markets Technologies - Alti Studi Lucca

Post on 21-Dec-2015

216 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 1 Formal Models for Transactions: Zero Safe Nets Roberto Bruni Dipartimento di Informatica Università di Pisa Models and Languages for Coordination and

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

Page 2: 1 Formal Models for Transactions: Zero Safe Nets Roberto Bruni Dipartimento di Informatica Università di Pisa Models and Languages for Coordination and

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

Page 3: 1 Formal Models for Transactions: Zero Safe Nets Roberto Bruni Dipartimento di Informatica Università di Pisa Models and Languages for Coordination and

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

Page 4: 1 Formal Models for Transactions: Zero Safe Nets Roberto Bruni Dipartimento di Informatica Università di Pisa Models and Languages for Coordination and

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)

Page 5: 1 Formal Models for Transactions: Zero Safe Nets Roberto Bruni Dipartimento di Informatica Università di Pisa Models and Languages for Coordination and

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

Page 6: 1 Formal Models for Transactions: Zero Safe Nets Roberto Bruni Dipartimento di Informatica Università di Pisa Models and Languages for Coordination and

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

Page 7: 1 Formal Models for Transactions: Zero Safe Nets Roberto Bruni Dipartimento di Informatica Università di Pisa Models and Languages for Coordination and

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!

Page 8: 1 Formal Models for Transactions: Zero Safe Nets Roberto Bruni Dipartimento di Informatica Università di Pisa Models and Languages for Coordination and

8

Roberto Bruni @ IMT Lucca 13 April 2005

Models and Languages for Coordination and Orchestration

InstitutionsMarketsTechnologies

IMT

Rendez-Vous

send receive

Ready to commit

Page 9: 1 Formal Models for Transactions: Zero Safe Nets Roberto Bruni Dipartimento di Informatica Università di Pisa Models and Languages for Coordination and

9

Roberto Bruni @ IMT Lucca 13 April 2005

Models and Languages for Coordination and Orchestration

InstitutionsMarketsTechnologies

IMT

Rendez-Vous

send receive

Coordinated commit

Page 10: 1 Formal Models for Transactions: Zero Safe Nets Roberto Bruni Dipartimento di Informatica Università di Pisa Models and Languages for Coordination and

10

Roberto Bruni @ IMT Lucca 13 April 2005

Models and Languages for Coordination and Orchestration

InstitutionsMarketsTechnologies

IMT

Nondeterministic Rendez-Vous

send

receive

receive

Page 11: 1 Formal Models for Transactions: Zero Safe Nets Roberto Bruni Dipartimento di Informatica Università di Pisa Models and Languages for Coordination and

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

Page 12: 1 Formal Models for Transactions: Zero Safe Nets Roberto Bruni Dipartimento di Informatica Università di Pisa Models and Languages for Coordination and

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

Page 13: 1 Formal Models for Transactions: Zero Safe Nets Roberto Bruni Dipartimento di Informatica Università di Pisa Models and Languages for Coordination and

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

Page 14: 1 Formal Models for Transactions: Zero Safe Nets Roberto Bruni Dipartimento di Informatica Università di Pisa Models and Languages for Coordination and

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

Page 15: 1 Formal Models for Transactions: Zero Safe Nets Roberto Bruni Dipartimento di Informatica Università di Pisa Models and Languages for Coordination and

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!

Page 16: 1 Formal Models for Transactions: Zero Safe Nets Roberto Bruni Dipartimento di Informatica Università di Pisa Models and Languages for Coordination and

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

Page 17: 1 Formal Models for Transactions: Zero Safe Nets Roberto Bruni Dipartimento di Informatica Università di Pisa Models and Languages for Coordination and

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!

Page 18: 1 Formal Models for Transactions: Zero Safe Nets Roberto Bruni Dipartimento di Informatica Università di Pisa Models and Languages for Coordination and

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!

Page 19: 1 Formal Models for Transactions: Zero Safe Nets Roberto Bruni Dipartimento di Informatica Università di Pisa Models and Languages for Coordination and

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…

Page 20: 1 Formal Models for Transactions: Zero Safe Nets Roberto Bruni Dipartimento di Informatica Università di Pisa Models and Languages for Coordination and

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!

Page 21: 1 Formal Models for Transactions: Zero Safe Nets Roberto Bruni Dipartimento di Informatica Università di Pisa Models and Languages for Coordination and

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

Page 22: 1 Formal Models for Transactions: Zero Safe Nets Roberto Bruni Dipartimento di Informatica Università di Pisa Models and Languages for Coordination and

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

Page 23: 1 Formal Models for Transactions: Zero Safe Nets Roberto Bruni Dipartimento di Informatica Università di Pisa Models and Languages for Coordination and

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

Page 24: 1 Formal Models for Transactions: Zero Safe Nets Roberto Bruni Dipartimento di Informatica Università di Pisa Models and Languages for Coordination and

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

Page 25: 1 Formal Models for Transactions: Zero Safe Nets Roberto Bruni Dipartimento di Informatica Università di Pisa Models and Languages for Coordination and

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

Page 26: 1 Formal Models for Transactions: Zero Safe Nets Roberto Bruni Dipartimento di Informatica Università di Pisa Models and Languages for Coordination and

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

Page 27: 1 Formal Models for Transactions: Zero Safe Nets Roberto Bruni Dipartimento di Informatica Università di Pisa Models and Languages for Coordination and

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

Page 28: 1 Formal Models for Transactions: Zero Safe Nets Roberto Bruni Dipartimento di Informatica Università di Pisa Models and Languages for Coordination and

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

Page 29: 1 Formal Models for Transactions: Zero Safe Nets Roberto Bruni Dipartimento di Informatica Università di Pisa Models and Languages for Coordination and

29

Roberto Bruni @ IMT Lucca 13 April 2005

Models and Languages for Coordination and Orchestration

InstitutionsMarketsTechnologies

IMT

Rendez-Vous

send receive

B A(B)

Page 30: 1 Formal Models for Transactions: Zero Safe Nets Roberto Bruni Dipartimento di Informatica Università di Pisa Models and Languages for Coordination and

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)

Page 31: 1 Formal Models for Transactions: Zero Safe Nets Roberto Bruni Dipartimento di Informatica Università di Pisa Models and Languages for Coordination and

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

Page 32: 1 Formal Models for Transactions: Zero Safe Nets Roberto Bruni Dipartimento di Informatica Università di Pisa Models and Languages for Coordination and

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!

Page 33: 1 Formal Models for Transactions: Zero Safe Nets Roberto Bruni Dipartimento di Informatica Università di Pisa Models and Languages for Coordination and

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!

Page 34: 1 Formal Models for Transactions: Zero Safe Nets Roberto Bruni Dipartimento di Informatica Università di Pisa Models and Languages for Coordination and

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

Page 35: 1 Formal Models for Transactions: Zero Safe Nets Roberto Bruni Dipartimento di Informatica Università di Pisa Models and Languages for Coordination and

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

Page 36: 1 Formal Models for Transactions: Zero Safe Nets Roberto Bruni Dipartimento di Informatica Università di Pisa Models and Languages for Coordination and

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

… …

Page 37: 1 Formal Models for Transactions: Zero Safe Nets Roberto Bruni Dipartimento di Informatica Università di Pisa Models and Languages for Coordination and

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

Page 38: 1 Formal Models for Transactions: Zero Safe Nets Roberto Bruni Dipartimento di Informatica Università di Pisa Models and Languages for Coordination and

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

Page 39: 1 Formal Models for Transactions: Zero Safe Nets Roberto Bruni Dipartimento di Informatica Università di Pisa Models and Languages for Coordination and

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