+ All Categories
Home > Documents > EE249 7 mocPetri BW.ppt - University of California, Berkeley...t5 t6 12 Concurrency, causality,...

EE249 7 mocPetri BW.ppt - University of California, Berkeley...t5 t6 12 Concurrency, causality,...

Date post: 06-Aug-2021
Category:
Upload: others
View: 2 times
Download: 0 times
Share this document with a friend
106
1 Outline Petri nets Introduction Examples Properties Analysis techniques
Transcript
Page 1: EE249 7 mocPetri BW.ppt - University of California, Berkeley...t5 t6 12 Concurrency, causality, choice Choice, conflict t1 t2 t3 t4 t5 t6 13 Concurrency, causality, choice Choice,

1

Outline

• Petri nets– Introduction

– Examples

– Properties

– Analysis techniques

Page 2: EE249 7 mocPetri BW.ppt - University of California, Berkeley...t5 t6 12 Concurrency, causality, choice Choice, conflict t1 t2 t3 t4 t5 t6 13 Concurrency, causality, choice Choice,

2

Petri Nets (PNs)

• Model introduced by C.A. Petri in 1962– Ph.D. Thesis: “Communication with Automata”

• Applications: distributed computing, manufacturing, control, communication networks, transportation…

• PNs describe explicitly and graphically:– sequencing/causality

– conflict/non-deterministic choice

– concurrency

• Basic PN model– Asynchronous model (partial ordering)

– Main drawback: no hierarchy

Page 3: EE249 7 mocPetri BW.ppt - University of California, Berkeley...t5 t6 12 Concurrency, causality, choice Choice, conflict t1 t2 t3 t4 t5 t6 13 Concurrency, causality, choice Choice,

3

Example: Synchronization at single track rail segment

• "Preconditions“

Page 4: EE249 7 mocPetri BW.ppt - University of California, Berkeley...t5 t6 12 Concurrency, causality, choice Choice, conflict t1 t2 t3 t4 t5 t6 13 Concurrency, causality, choice Choice,

4

Playing the “token game“

Page 5: EE249 7 mocPetri BW.ppt - University of California, Berkeley...t5 t6 12 Concurrency, causality, choice Choice, conflict t1 t2 t3 t4 t5 t6 13 Concurrency, causality, choice Choice,

5

Conflict for resource “track“

Page 6: EE249 7 mocPetri BW.ppt - University of California, Berkeley...t5 t6 12 Concurrency, causality, choice Choice, conflict t1 t2 t3 t4 t5 t6 13 Concurrency, causality, choice Choice,

6

Petri Net Graph

• Bipartite weighted directed graph:– Places: circles– Transitions: bars or boxes– Arcs: arrows labeled with weights

• Tokens: black dots

t1p1

p2t2

p4

t3

p3

2

3

Page 7: EE249 7 mocPetri BW.ppt - University of California, Berkeley...t5 t6 12 Concurrency, causality, choice Choice, conflict t1 t2 t3 t4 t5 t6 13 Concurrency, causality, choice Choice,

7

Petri Net• A PN (N,M0) is a Petri Net Graph N

– places: represent distributed state by holding tokens

– marking (state) M is an n-vector (m1,m2,m3…), where mi is the non-negative number of tokens in place pi.

– initial marking (M0) is initial state

– transitions: represent actions/events

– enabled transition: enough tokens in predecessors

– firing transition: modifies marking

• …and an initial marking M0.t1p1

p2t2

p4

t3p3

2

3Places/Transitions: conditions/events

Page 8: EE249 7 mocPetri BW.ppt - University of California, Berkeley...t5 t6 12 Concurrency, causality, choice Choice, conflict t1 t2 t3 t4 t5 t6 13 Concurrency, causality, choice Choice,

8

Transition firing rule• A marking is changed according to the following rules:

– A transition is enabled if there are enough tokens in each input place

– An enabled transition may or may not fire

– The firing of a transition modifies marking by consuming tokens from the input places and producing tokens in the output places

2 2

3

2 2

3

Page 9: EE249 7 mocPetri BW.ppt - University of California, Berkeley...t5 t6 12 Concurrency, causality, choice Choice, conflict t1 t2 t3 t4 t5 t6 13 Concurrency, causality, choice Choice,

9

Concurrency, causality, choice

t1

t2

t3 t4

t5

t6

Page 10: EE249 7 mocPetri BW.ppt - University of California, Berkeley...t5 t6 12 Concurrency, causality, choice Choice, conflict t1 t2 t3 t4 t5 t6 13 Concurrency, causality, choice Choice,

10

Concurrency, causality, choice

Concurrency

t1

t2

t3 t4

t5

t6

Page 11: EE249 7 mocPetri BW.ppt - University of California, Berkeley...t5 t6 12 Concurrency, causality, choice Choice, conflict t1 t2 t3 t4 t5 t6 13 Concurrency, causality, choice Choice,

11

Concurrency, causality, choice

Causality, sequencing

t1

t2

t3 t4

t5

t6

Page 12: EE249 7 mocPetri BW.ppt - University of California, Berkeley...t5 t6 12 Concurrency, causality, choice Choice, conflict t1 t2 t3 t4 t5 t6 13 Concurrency, causality, choice Choice,

12

Concurrency, causality, choice

Choice,conflict

t1

t2

t3 t4

t5

t6

Page 13: EE249 7 mocPetri BW.ppt - University of California, Berkeley...t5 t6 12 Concurrency, causality, choice Choice, conflict t1 t2 t3 t4 t5 t6 13 Concurrency, causality, choice Choice,

13

Concurrency, causality, choice

Choice,conflict

t1

t2

t3 t4

t5

t6

Page 14: EE249 7 mocPetri BW.ppt - University of California, Berkeley...t5 t6 12 Concurrency, causality, choice Choice, conflict t1 t2 t3 t4 t5 t6 13 Concurrency, causality, choice Choice,

14

Communication Protocol

P1

Send msg

Receive Ack

Send Ack

Receive msg

P2

Page 15: EE249 7 mocPetri BW.ppt - University of California, Berkeley...t5 t6 12 Concurrency, causality, choice Choice, conflict t1 t2 t3 t4 t5 t6 13 Concurrency, causality, choice Choice,

15

Communication Protocol

P1

Send msg

Receive Ack

Send Ack

Receive msg

P2

Page 16: EE249 7 mocPetri BW.ppt - University of California, Berkeley...t5 t6 12 Concurrency, causality, choice Choice, conflict t1 t2 t3 t4 t5 t6 13 Concurrency, causality, choice Choice,

16

Communication Protocol

P1

Send msg

Receive Ack

Send Ack

Receive msg

P2

Page 17: EE249 7 mocPetri BW.ppt - University of California, Berkeley...t5 t6 12 Concurrency, causality, choice Choice, conflict t1 t2 t3 t4 t5 t6 13 Concurrency, causality, choice Choice,

17

Communication Protocol

P1

Send msg

Receive Ack

Send Ack

Receive msg

P2

Page 18: EE249 7 mocPetri BW.ppt - University of California, Berkeley...t5 t6 12 Concurrency, causality, choice Choice, conflict t1 t2 t3 t4 t5 t6 13 Concurrency, causality, choice Choice,

18

Communication Protocol

P1

Send msg

Receive Ack

Send Ack

Receive msg

P2

Page 19: EE249 7 mocPetri BW.ppt - University of California, Berkeley...t5 t6 12 Concurrency, causality, choice Choice, conflict t1 t2 t3 t4 t5 t6 13 Concurrency, causality, choice Choice,

19

Communication Protocol

P1

Send msg

Receive Ack

Send Ack

Receive msg

P2

Page 20: EE249 7 mocPetri BW.ppt - University of California, Berkeley...t5 t6 12 Concurrency, causality, choice Choice, conflict t1 t2 t3 t4 t5 t6 13 Concurrency, causality, choice Choice,

20

Producer-Consumer Problem

Produce

Consume

Buffer

Page 21: EE249 7 mocPetri BW.ppt - University of California, Berkeley...t5 t6 12 Concurrency, causality, choice Choice, conflict t1 t2 t3 t4 t5 t6 13 Concurrency, causality, choice Choice,

21

Producer-Consumer Problem

Produce

Consume

Buffer

Page 22: EE249 7 mocPetri BW.ppt - University of California, Berkeley...t5 t6 12 Concurrency, causality, choice Choice, conflict t1 t2 t3 t4 t5 t6 13 Concurrency, causality, choice Choice,

22

Producer-Consumer Problem

Produce

Consume

Buffer

Page 23: EE249 7 mocPetri BW.ppt - University of California, Berkeley...t5 t6 12 Concurrency, causality, choice Choice, conflict t1 t2 t3 t4 t5 t6 13 Concurrency, causality, choice Choice,

23

Producer-Consumer Problem

Produce

Consume

Buffer

Page 24: EE249 7 mocPetri BW.ppt - University of California, Berkeley...t5 t6 12 Concurrency, causality, choice Choice, conflict t1 t2 t3 t4 t5 t6 13 Concurrency, causality, choice Choice,

24

Producer-Consumer Problem

Produce

Consume

Buffer

Page 25: EE249 7 mocPetri BW.ppt - University of California, Berkeley...t5 t6 12 Concurrency, causality, choice Choice, conflict t1 t2 t3 t4 t5 t6 13 Concurrency, causality, choice Choice,

25

Producer-Consumer Problem

Produce

Consume

Buffer

Page 26: EE249 7 mocPetri BW.ppt - University of California, Berkeley...t5 t6 12 Concurrency, causality, choice Choice, conflict t1 t2 t3 t4 t5 t6 13 Concurrency, causality, choice Choice,

26

Producer-Consumer Problem

Produce

Consume

Buffer

Page 27: EE249 7 mocPetri BW.ppt - University of California, Berkeley...t5 t6 12 Concurrency, causality, choice Choice, conflict t1 t2 t3 t4 t5 t6 13 Concurrency, causality, choice Choice,

27

Producer-Consumer Problem

Produce

Consume

Buffer

Page 28: EE249 7 mocPetri BW.ppt - University of California, Berkeley...t5 t6 12 Concurrency, causality, choice Choice, conflict t1 t2 t3 t4 t5 t6 13 Concurrency, causality, choice Choice,

28

Producer-Consumer Problem

Produce

Consume

Buffer

Page 29: EE249 7 mocPetri BW.ppt - University of California, Berkeley...t5 t6 12 Concurrency, causality, choice Choice, conflict t1 t2 t3 t4 t5 t6 13 Concurrency, causality, choice Choice,

29

Producer-Consumer Problem

Produce

Consume

Buffer

Page 30: EE249 7 mocPetri BW.ppt - University of California, Berkeley...t5 t6 12 Concurrency, causality, choice Choice, conflict t1 t2 t3 t4 t5 t6 13 Concurrency, causality, choice Choice,

30

Producer-Consumer Problem

Produce

Consume

Buffer

Page 31: EE249 7 mocPetri BW.ppt - University of California, Berkeley...t5 t6 12 Concurrency, causality, choice Choice, conflict t1 t2 t3 t4 t5 t6 13 Concurrency, causality, choice Choice,

31

Producer-Consumer Problem

Produce

Consume

Buffer

Page 32: EE249 7 mocPetri BW.ppt - University of California, Berkeley...t5 t6 12 Concurrency, causality, choice Choice, conflict t1 t2 t3 t4 t5 t6 13 Concurrency, causality, choice Choice,

32

Producer-Consumer Problem

Produce

Consume

Buffer

Page 33: EE249 7 mocPetri BW.ppt - University of California, Berkeley...t5 t6 12 Concurrency, causality, choice Choice, conflict t1 t2 t3 t4 t5 t6 13 Concurrency, causality, choice Choice,

33

Producer-Consumer Problem

Produce

Consume

Buffer

Page 34: EE249 7 mocPetri BW.ppt - University of California, Berkeley...t5 t6 12 Concurrency, causality, choice Choice, conflict t1 t2 t3 t4 t5 t6 13 Concurrency, causality, choice Choice,

34

Producer-Consumer with priority

Consumer B can consume only if buffer A is empty

Inhibitor arcs

A

B

Page 35: EE249 7 mocPetri BW.ppt - University of California, Berkeley...t5 t6 12 Concurrency, causality, choice Choice, conflict t1 t2 t3 t4 t5 t6 13 Concurrency, causality, choice Choice,

35

PN properties

• Behavioral: depend on the initial marking (most interesting)– Reachability

– Boundedness

– Schedulability

– Liveness

– Conservation

• Structural: do not depend on the initial marking (often too restrictive)– Consistency

– Structural boundedness

Page 36: EE249 7 mocPetri BW.ppt - University of California, Berkeley...t5 t6 12 Concurrency, causality, choice Choice, conflict t1 t2 t3 t4 t5 t6 13 Concurrency, causality, choice Choice,

36

Reachability

• Marking M is reachable from marking M0 if there exists a sequence of firings M0 t1 M1 t2 M2… M that transforms M0 to M.

• The reachability problem is decidable.

t1p1

p2t2

p4

t3p3

= (1,0,1,0)M = (1,1,0,0)

= (1,0,1,0)t3

M1 = (1,0,0,1)t2

M = (1,1,0,0)

Page 37: EE249 7 mocPetri BW.ppt - University of California, Berkeley...t5 t6 12 Concurrency, causality, choice Choice, conflict t1 t2 t3 t4 t5 t6 13 Concurrency, causality, choice Choice,

37

• Liveness: from any marking any transition can become fireable– Liveness implies deadlock freedom, not viceversa

Liveness

Not live

Page 38: EE249 7 mocPetri BW.ppt - University of California, Berkeley...t5 t6 12 Concurrency, causality, choice Choice, conflict t1 t2 t3 t4 t5 t6 13 Concurrency, causality, choice Choice,

38

• Liveness: from any marking any transition can become fireable– Liveness implies deadlock freedom, not viceversa

Liveness

Not live

Page 39: EE249 7 mocPetri BW.ppt - University of California, Berkeley...t5 t6 12 Concurrency, causality, choice Choice, conflict t1 t2 t3 t4 t5 t6 13 Concurrency, causality, choice Choice,

39

• Liveness: from any marking any transition can become fireable– Liveness implies deadlock freedom, not viceversa

Liveness

Deadlock-free

Page 40: EE249 7 mocPetri BW.ppt - University of California, Berkeley...t5 t6 12 Concurrency, causality, choice Choice, conflict t1 t2 t3 t4 t5 t6 13 Concurrency, causality, choice Choice,

40

• Liveness: from any marking any transition can become fireable– Liveness implies deadlock freedom, not viceversa

Liveness

Deadlock-free

Page 41: EE249 7 mocPetri BW.ppt - University of California, Berkeley...t5 t6 12 Concurrency, causality, choice Choice, conflict t1 t2 t3 t4 t5 t6 13 Concurrency, causality, choice Choice,

41

• Boundedness: the number of tokens in any place cannot grow indefinitely

– (1-bounded also called safe)

– Application: places represent buffers and registers (check there is no overflow)

Boundedness

Unbounded

Page 42: EE249 7 mocPetri BW.ppt - University of California, Berkeley...t5 t6 12 Concurrency, causality, choice Choice, conflict t1 t2 t3 t4 t5 t6 13 Concurrency, causality, choice Choice,

42

• Boundedness: the number of tokens in any place cannot grow indefinitely

– (1-bounded also called safe)

– Application: places represent buffers and registers (check there is no overflow)

Boundedness

Unbounded

Page 43: EE249 7 mocPetri BW.ppt - University of California, Berkeley...t5 t6 12 Concurrency, causality, choice Choice, conflict t1 t2 t3 t4 t5 t6 13 Concurrency, causality, choice Choice,

43

• Boundedness: the number of tokens in any place cannot grow indefinitely

– (1-bounded also called safe)

– Application: places represent buffers and registers (check there is no overflow)

Boundedness

Unbounded

Page 44: EE249 7 mocPetri BW.ppt - University of California, Berkeley...t5 t6 12 Concurrency, causality, choice Choice, conflict t1 t2 t3 t4 t5 t6 13 Concurrency, causality, choice Choice,

44

• Boundedness: the number of tokens in any place cannot grow indefinitely

– (1-bounded also called safe)

– Application: places represent buffers and registers (check there is no overflow)

Boundedness

Unbounded

Page 45: EE249 7 mocPetri BW.ppt - University of California, Berkeley...t5 t6 12 Concurrency, causality, choice Choice, conflict t1 t2 t3 t4 t5 t6 13 Concurrency, causality, choice Choice,

45

• Boundedness: the number of tokens in any place cannot grow indefinitely

– (1-bounded also called safe)

– Application: places represent buffers and registers (check there is no overflow)

Boundedness

Unbounded

Page 46: EE249 7 mocPetri BW.ppt - University of California, Berkeley...t5 t6 12 Concurrency, causality, choice Choice, conflict t1 t2 t3 t4 t5 t6 13 Concurrency, causality, choice Choice,

46

Conservation

• Conservation: the total number of tokens in the net is constant

Not conservative

Page 47: EE249 7 mocPetri BW.ppt - University of California, Berkeley...t5 t6 12 Concurrency, causality, choice Choice, conflict t1 t2 t3 t4 t5 t6 13 Concurrency, causality, choice Choice,

47

Conservation

• Conservation: the total number of tokens in the net is constant

Not conservative

Page 48: EE249 7 mocPetri BW.ppt - University of California, Berkeley...t5 t6 12 Concurrency, causality, choice Choice, conflict t1 t2 t3 t4 t5 t6 13 Concurrency, causality, choice Choice,

48

Conservation

• Conservation: the total number of tokens in the net is constant

Conservative

2

2

Page 49: EE249 7 mocPetri BW.ppt - University of California, Berkeley...t5 t6 12 Concurrency, causality, choice Choice, conflict t1 t2 t3 t4 t5 t6 13 Concurrency, causality, choice Choice,

49

Analysis techniques

• Structural analysis techniques– Incidence matrix

– T- and S- Invariants

• State Space Analysis techniques– Coverability Tree

– Reachability Graph

Page 50: EE249 7 mocPetri BW.ppt - University of California, Berkeley...t5 t6 12 Concurrency, causality, choice Choice, conflict t1 t2 t3 t4 t5 t6 13 Concurrency, causality, choice Choice,

50

Incidence Matrix

• Necessary condition for marking M to be reachable from initial marking M0:

there exists firing vector v s.t.:

M = M0 + A v

p1 p2 p3t1t2

t3A=

-1 0 01 1 -10 -1 1

t1 t2 t3p1p2p3

Page 51: EE249 7 mocPetri BW.ppt - University of California, Berkeley...t5 t6 12 Concurrency, causality, choice Choice, conflict t1 t2 t3 t4 t5 t6 13 Concurrency, causality, choice Choice,

51

State equations

p1 p2 p3t1

t3

A=-1 0 01 1 -10 -1 1

• E.g. reachability of M = |0 0 1|T from M0 = |1 0 0|T

but also v2 = | 1 1 2 |T or any vk = | 1 (k) (k+1) |T

t2

100

+-1 0 01 1 -10 -1 1

001

=101

v1 =101

Page 52: EE249 7 mocPetri BW.ppt - University of California, Berkeley...t5 t6 12 Concurrency, causality, choice Choice, conflict t1 t2 t3 t4 t5 t6 13 Concurrency, causality, choice Choice,

52

Necessary Condition only

2 2

Firing vector: (1,2,2)

t1

t2

t3

Deadlock!!

Page 53: EE249 7 mocPetri BW.ppt - University of California, Berkeley...t5 t6 12 Concurrency, causality, choice Choice, conflict t1 t2 t3 t4 t5 t6 13 Concurrency, causality, choice Choice,

53

State equations and invariants

• Solutions of Ax = 0 (in M = M0 + Ax, M = M0)

T-invariants– sequences of transitions that (if fireable) bring back to original marking

– periodic schedule in SDF

– e.g. x =| 0 1 1 |T

p1 p2 p3t1

t3

A=-1 0 01 1 -10 -1 1

t2

Page 54: EE249 7 mocPetri BW.ppt - University of California, Berkeley...t5 t6 12 Concurrency, causality, choice Choice, conflict t1 t2 t3 t4 t5 t6 13 Concurrency, causality, choice Choice,

54

Application of T-invariants

• Scheduling– Cyclic schedules: need to return to the initial state

i *k2 +

*k1

Schedule: i *k2 *k1 + oT-invariant: (1,1,1,1,1)

o

Page 55: EE249 7 mocPetri BW.ppt - University of California, Berkeley...t5 t6 12 Concurrency, causality, choice Choice, conflict t1 t2 t3 t4 t5 t6 13 Concurrency, causality, choice Choice,

55

State equations and invariants

• Solutions of yA = 0

S-invariants– sets of places whose weighted total token count does not change after

the firing of any transition (y M = y M’)

– e.g. y =| 1 1 1 |T

p1 p2 p3t1

t3

AT=-1 1 00 1 -10 -1 1

t2

Page 56: EE249 7 mocPetri BW.ppt - University of California, Berkeley...t5 t6 12 Concurrency, causality, choice Choice, conflict t1 t2 t3 t4 t5 t6 13 Concurrency, causality, choice Choice,

56

Application of S-invariants

• Structural Boundedness: bounded for any finite initial marking M0

• Existence of a positive S-invariant is sufficient condition for structural boundedness – initial marking is finite

– weighted token count does not change

Page 57: EE249 7 mocPetri BW.ppt - University of California, Berkeley...t5 t6 12 Concurrency, causality, choice Choice, conflict t1 t2 t3 t4 t5 t6 13 Concurrency, causality, choice Choice,

57

Summary of algebraic methods

• Extremely efficient (polynomial in the size of the net)

• Generally provide only necessary or sufficient information

• Excellent for ruling out some deadlocks or otherwise dangerous conditions

• Can be used to infer structural boundedness

Page 58: EE249 7 mocPetri BW.ppt - University of California, Berkeley...t5 t6 12 Concurrency, causality, choice Choice, conflict t1 t2 t3 t4 t5 t6 13 Concurrency, causality, choice Choice,

58

Coverability Tree

• Build a (finite) tree representation of the markings

Karp-Miller algorithm• Label initial marking M0 as the root of the tree and tag it as new

• While new markings exist do:– select a new marking M

– if M is identical to a marking on the path from the root to M, then tag M as old and go to another new marking

– if no transitions are enabled at M, tag M dead-end

– while there exist enabled transitions at M do:– obtain the marking M’ that results from firing t at M

– on the path from the root to M if there exists a marking M’’ such that M’(p)>=M’’(p) for each place p and M’ is different from M’’, then replace M’(p) by for each p such that M’(p) >M’’(p)

– introduce M’ as a node, draw an arc with label t from M to M’ and tag M’ as new.

Page 59: EE249 7 mocPetri BW.ppt - University of California, Berkeley...t5 t6 12 Concurrency, causality, choice Choice, conflict t1 t2 t3 t4 t5 t6 13 Concurrency, causality, choice Choice,

59

Coverability Tree

• Boundedness is decidable with coverability tree

p1 p2 p3

p4

t1t2

t3

1000

Page 60: EE249 7 mocPetri BW.ppt - University of California, Berkeley...t5 t6 12 Concurrency, causality, choice Choice, conflict t1 t2 t3 t4 t5 t6 13 Concurrency, causality, choice Choice,

60

Coverability Tree

• Boundedness is decidable with coverability tree

p1 p2 p3

p4

t1t2

t3

1000

0100t1

Page 61: EE249 7 mocPetri BW.ppt - University of California, Berkeley...t5 t6 12 Concurrency, causality, choice Choice, conflict t1 t2 t3 t4 t5 t6 13 Concurrency, causality, choice Choice,

61

Coverability Tree

• Boundedness is decidable

with coverability tree

p1 p2 p3

p4

t1t2

t3

1000

0100

0011

t1

t3

Page 62: EE249 7 mocPetri BW.ppt - University of California, Berkeley...t5 t6 12 Concurrency, causality, choice Choice, conflict t1 t2 t3 t4 t5 t6 13 Concurrency, causality, choice Choice,

62

Coverability Tree

• Boundedness is decidable

with coverability tree

p1 p2 p3

p4

t1t2

t3

1000

0100

0011

t1

t3

0101t2

Page 63: EE249 7 mocPetri BW.ppt - University of California, Berkeley...t5 t6 12 Concurrency, causality, choice Choice, conflict t1 t2 t3 t4 t5 t6 13 Concurrency, causality, choice Choice,

63

Coverability Tree

• Boundedness is decidable

with coverability tree

p1 p2 p3

p4

t1t2

t3

1000

0100

0011

t1

t3

t2010

Page 64: EE249 7 mocPetri BW.ppt - University of California, Berkeley...t5 t6 12 Concurrency, causality, choice Choice, conflict t1 t2 t3 t4 t5 t6 13 Concurrency, causality, choice Choice,

64

Coverability Tree

• Is (1) reachable from (0)?

t1 p1 t2

t1 p1 t22 2

Page 65: EE249 7 mocPetri BW.ppt - University of California, Berkeley...t5 t6 12 Concurrency, causality, choice Choice, conflict t1 t2 t3 t4 t5 t6 13 Concurrency, causality, choice Choice,

65

Coverability Tree

• Is (1) reachable from (0)?

t1 p1 t2

t1

0t1

p1 t22 2

(0) (1) (2)…

Page 66: EE249 7 mocPetri BW.ppt - University of California, Berkeley...t5 t6 12 Concurrency, causality, choice Choice, conflict t1 t2 t3 t4 t5 t6 13 Concurrency, causality, choice Choice,

66

Coverability Tree

• Is (1) reachable from (0)?

t1 p1 t2

t1

0t1

0t1

p1 t22 2

(0) (1) (2)…

(0) (2) (0)…

Page 67: EE249 7 mocPetri BW.ppt - University of California, Berkeley...t5 t6 12 Concurrency, causality, choice Choice, conflict t1 t2 t3 t4 t5 t6 13 Concurrency, causality, choice Choice,

67

Coverability Tree

• Cannot solve the reachability problem

t1 p1 t2

t1

0t1

0t1

p1 t22 2

(0) (1) (2)…

(0) (2) (0)…

• Is (1) reachable from (0)?

Page 68: EE249 7 mocPetri BW.ppt - University of California, Berkeley...t5 t6 12 Concurrency, causality, choice Choice, conflict t1 t2 t3 t4 t5 t6 13 Concurrency, causality, choice Choice,

68

Reachability graph

p1 p2 p3t1t2

t3

100

• For bounded nets the Coverability Tree is called Reachability Tree since it contains all possible reachable markings

Page 69: EE249 7 mocPetri BW.ppt - University of California, Berkeley...t5 t6 12 Concurrency, causality, choice Choice, conflict t1 t2 t3 t4 t5 t6 13 Concurrency, causality, choice Choice,

69

Reachability graph

p1 p2 p3t1t2

t3

100

010t1

• For bounded nets the Coverability Tree is called Reachability Tree since it contains all possible reachable markings

Page 70: EE249 7 mocPetri BW.ppt - University of California, Berkeley...t5 t6 12 Concurrency, causality, choice Choice, conflict t1 t2 t3 t4 t5 t6 13 Concurrency, causality, choice Choice,

70

Reachability graph

p1 p2 p3t1t2

t3

100

010

001

t1

t3

• For bounded nets the Coverability Tree is called Reachability Tree since it contains all possible reachable markings

Page 71: EE249 7 mocPetri BW.ppt - University of California, Berkeley...t5 t6 12 Concurrency, causality, choice Choice, conflict t1 t2 t3 t4 t5 t6 13 Concurrency, causality, choice Choice,

71

Reachability graph

p1 p2 p3t1t2

t3

100

010

001

t1

t3t2

• For bounded nets the Coverability Tree is called Reachability Tree since it contains all possible reachable markings

Page 72: EE249 7 mocPetri BW.ppt - University of California, Berkeley...t5 t6 12 Concurrency, causality, choice Choice, conflict t1 t2 t3 t4 t5 t6 13 Concurrency, causality, choice Choice,

72

Subclasses of Petri nets

• Reachability analysis is too expensive

• State equations give only partial information

• Some properties are preserved by reduction rulese.g. for liveness and safeness

• Even reduction rules only work in some cases

• Must restrict class in order to prove stronger results

Page 73: EE249 7 mocPetri BW.ppt - University of California, Berkeley...t5 t6 12 Concurrency, causality, choice Choice, conflict t1 t2 t3 t4 t5 t6 13 Concurrency, causality, choice Choice,

73

Marked Graphs

• Every place has at most 1 predecessor and 1 successor transition

• Models only causality and concurrency (no conflict)

NO

YES

Page 74: EE249 7 mocPetri BW.ppt - University of California, Berkeley...t5 t6 12 Concurrency, causality, choice Choice, conflict t1 t2 t3 t4 t5 t6 13 Concurrency, causality, choice Choice,

74

State Machines

• Every transition has at most 1 predecessor and 1 successor place

• Models only causality and conflict– (no concurrency, no synchronization of parallel activities)

YES NO

Page 75: EE249 7 mocPetri BW.ppt - University of California, Berkeley...t5 t6 12 Concurrency, causality, choice Choice, conflict t1 t2 t3 t4 t5 t6 13 Concurrency, causality, choice Choice,

75

Free-Choice Petri Nets (FCPN)

Free-Choice (FC)

Extended Free-Choice Confusion (not-Free-Choice)

t1

t2

Free-Choice: the outcome of a choice depends on the value of a token (abstracted non-deterministically) rather than on its arrival time.

every transition after choice has exactly 1 predecessor place

Page 76: EE249 7 mocPetri BW.ppt - University of California, Berkeley...t5 t6 12 Concurrency, causality, choice Choice, conflict t1 t2 t3 t4 t5 t6 13 Concurrency, causality, choice Choice,

76

Free-Choice nets

• Introduced by Hack (‘72)• Extensively studied by Best (‘86) and Desel and Esparza (‘95)• Can express concurrency, causality and choice without confusion• Very strong structural theory

– necessary and sufficient conditions for liveness and safeness, based on decomposition

– exploits duality between MG and SM

Page 77: EE249 7 mocPetri BW.ppt - University of California, Berkeley...t5 t6 12 Concurrency, causality, choice Choice, conflict t1 t2 t3 t4 t5 t6 13 Concurrency, causality, choice Choice,

77

MG (& SM) decomposition

• An Allocation is a control function that chooses which transition fires among several conflicting ones ( A: P T).

• Eliminate the subnet that would be inactive if we were to use the allocation...

• Reduction Algorithm– Delete all unallocated transitions

– Delete all places that have all input transitions already deleted

– Delete all transitions that have at least one input place already deleted

• Obtain a Reduction (one for each allocation) that is a conflict free subnet

Page 78: EE249 7 mocPetri BW.ppt - University of California, Berkeley...t5 t6 12 Concurrency, causality, choice Choice, conflict t1 t2 t3 t4 t5 t6 13 Concurrency, causality, choice Choice,

78

• Choose one successor for each conflicting place:

MG reduction and cover

Page 79: EE249 7 mocPetri BW.ppt - University of California, Berkeley...t5 t6 12 Concurrency, causality, choice Choice, conflict t1 t2 t3 t4 t5 t6 13 Concurrency, causality, choice Choice,

79

• Choose one successor for each conflicting place:

MG reduction and cover

Page 80: EE249 7 mocPetri BW.ppt - University of California, Berkeley...t5 t6 12 Concurrency, causality, choice Choice, conflict t1 t2 t3 t4 t5 t6 13 Concurrency, causality, choice Choice,

80

• Choose one successor for each conflicting place:

MG reduction and cover

Page 81: EE249 7 mocPetri BW.ppt - University of California, Berkeley...t5 t6 12 Concurrency, causality, choice Choice, conflict t1 t2 t3 t4 t5 t6 13 Concurrency, causality, choice Choice,

81

• Choose one successor for each conflicting place:

MG reduction and cover

Page 82: EE249 7 mocPetri BW.ppt - University of California, Berkeley...t5 t6 12 Concurrency, causality, choice Choice, conflict t1 t2 t3 t4 t5 t6 13 Concurrency, causality, choice Choice,

82

• Choose one successor for each conflicting place:

MG reduction and cover

Page 83: EE249 7 mocPetri BW.ppt - University of California, Berkeley...t5 t6 12 Concurrency, causality, choice Choice, conflict t1 t2 t3 t4 t5 t6 13 Concurrency, causality, choice Choice,

83

MG reductions

• The set of all reductions yields a cover of MG components (T-invariants)

Page 84: EE249 7 mocPetri BW.ppt - University of California, Berkeley...t5 t6 12 Concurrency, causality, choice Choice, conflict t1 t2 t3 t4 t5 t6 13 Concurrency, causality, choice Choice,

84

MG reductions

• The set of all reductions yields a cover of MG components (T-invariants)

Page 85: EE249 7 mocPetri BW.ppt - University of California, Berkeley...t5 t6 12 Concurrency, causality, choice Choice, conflict t1 t2 t3 t4 t5 t6 13 Concurrency, causality, choice Choice,

85

MG reductions

• The set of all reductions yields a cover of MG components (T-invariants)

Page 86: EE249 7 mocPetri BW.ppt - University of California, Berkeley...t5 t6 12 Concurrency, causality, choice Choice, conflict t1 t2 t3 t4 t5 t6 13 Concurrency, causality, choice Choice,

86

Hack’s theorem (‘72)

• Let N be a Free-Choice PN:– N has a live and safe initial marking (well-formed)

if and only if– every MG reduction is strongly connected and not empty, and

the set of all reductions covers the net

– every SM reduction is strongly connected and not empty, and

the set of all reductions covers the net

Page 87: EE249 7 mocPetri BW.ppt - University of California, Berkeley...t5 t6 12 Concurrency, causality, choice Choice, conflict t1 t2 t3 t4 t5 t6 13 Concurrency, causality, choice Choice,

87

Hack’s theorem

• Example of non-live (but safe) FCN

Page 88: EE249 7 mocPetri BW.ppt - University of California, Berkeley...t5 t6 12 Concurrency, causality, choice Choice, conflict t1 t2 t3 t4 t5 t6 13 Concurrency, causality, choice Choice,

88

Hack’s theorem

• Example of non-live (but safe) FCN

Page 89: EE249 7 mocPetri BW.ppt - University of California, Berkeley...t5 t6 12 Concurrency, causality, choice Choice, conflict t1 t2 t3 t4 t5 t6 13 Concurrency, causality, choice Choice,

89

Hack’s theorem

• Example of non-live (but safe) FCN

Page 90: EE249 7 mocPetri BW.ppt - University of California, Berkeley...t5 t6 12 Concurrency, causality, choice Choice, conflict t1 t2 t3 t4 t5 t6 13 Concurrency, causality, choice Choice,

90

Hack’s theorem

• Example of non-live (but safe) FCN

Page 91: EE249 7 mocPetri BW.ppt - University of California, Berkeley...t5 t6 12 Concurrency, causality, choice Choice, conflict t1 t2 t3 t4 t5 t6 13 Concurrency, causality, choice Choice,

91

Hack’s theorem

• Example of non-live (but safe) FCN

Page 92: EE249 7 mocPetri BW.ppt - University of California, Berkeley...t5 t6 12 Concurrency, causality, choice Choice, conflict t1 t2 t3 t4 t5 t6 13 Concurrency, causality, choice Choice,

92

Hack’s theorem

• Example of non-live (but safe) FCN

Page 93: EE249 7 mocPetri BW.ppt - University of California, Berkeley...t5 t6 12 Concurrency, causality, choice Choice, conflict t1 t2 t3 t4 t5 t6 13 Concurrency, causality, choice Choice,

93

Hack’s theorem

• Example of non-live (but safe) FCN

Page 94: EE249 7 mocPetri BW.ppt - University of California, Berkeley...t5 t6 12 Concurrency, causality, choice Choice, conflict t1 t2 t3 t4 t5 t6 13 Concurrency, causality, choice Choice,

94

Hack’s theorem

• Example of non-live (but safe) FCN

Page 95: EE249 7 mocPetri BW.ppt - University of California, Berkeley...t5 t6 12 Concurrency, causality, choice Choice, conflict t1 t2 t3 t4 t5 t6 13 Concurrency, causality, choice Choice,

95

Hack’s theorem

• Example of non-live (but safe) FCN

Page 96: EE249 7 mocPetri BW.ppt - University of California, Berkeley...t5 t6 12 Concurrency, causality, choice Choice, conflict t1 t2 t3 t4 t5 t6 13 Concurrency, causality, choice Choice,

96

Hack’s theorem

• Example of non-live (but safe) FCN

Page 97: EE249 7 mocPetri BW.ppt - University of California, Berkeley...t5 t6 12 Concurrency, causality, choice Choice, conflict t1 t2 t3 t4 t5 t6 13 Concurrency, causality, choice Choice,

97

Hack’s theorem

• Example of non-live (but safe) FCN

Page 98: EE249 7 mocPetri BW.ppt - University of California, Berkeley...t5 t6 12 Concurrency, causality, choice Choice, conflict t1 t2 t3 t4 t5 t6 13 Concurrency, causality, choice Choice,

98

Hack’s theorem

• Example of non-live (but safe) FCN

Page 99: EE249 7 mocPetri BW.ppt - University of California, Berkeley...t5 t6 12 Concurrency, causality, choice Choice, conflict t1 t2 t3 t4 t5 t6 13 Concurrency, causality, choice Choice,

99

Hack’s theorem

• Example of non-live (but safe) FCN

Page 100: EE249 7 mocPetri BW.ppt - University of California, Berkeley...t5 t6 12 Concurrency, causality, choice Choice, conflict t1 t2 t3 t4 t5 t6 13 Concurrency, causality, choice Choice,

100

Hack’s theorem

• Example of non-live (but safe) FCN

Page 101: EE249 7 mocPetri BW.ppt - University of California, Berkeley...t5 t6 12 Concurrency, causality, choice Choice, conflict t1 t2 t3 t4 t5 t6 13 Concurrency, causality, choice Choice,

101

Hack’s theorem

• Example of non-live (but safe) FCN

Page 102: EE249 7 mocPetri BW.ppt - University of California, Berkeley...t5 t6 12 Concurrency, causality, choice Choice, conflict t1 t2 t3 t4 t5 t6 13 Concurrency, causality, choice Choice,

102

Hack’s theorem

• Example of non-live (but safe) FCN

Deadlock

Page 103: EE249 7 mocPetri BW.ppt - University of California, Berkeley...t5 t6 12 Concurrency, causality, choice Choice, conflict t1 t2 t3 t4 t5 t6 13 Concurrency, causality, choice Choice,

103

Summary of LSFC nets

• Largest class for which structural theory really helps

• Structural component analysis may be expensive (exponential number of MG and SM components in the worst case)

• But… – number of MG components is generally small

– FC restriction simplifies characterization of behavior

Page 104: EE249 7 mocPetri BW.ppt - University of California, Berkeley...t5 t6 12 Concurrency, causality, choice Choice, conflict t1 t2 t3 t4 t5 t6 13 Concurrency, causality, choice Choice,

104

Petri Net extensions

• Add interpretation to tokens and transitions– Colored nets (tokens have value)

• Add time– Time/timed Petri Nets (deterministic delay)

– type (duration, delay)– where (place, transition)

– Stochastic PNs (probabilistic delay)– Generalized Stochastic PNs (timed and immediate transitions)

• Add hierarchy– Place Charts Nets

Page 105: EE249 7 mocPetri BW.ppt - University of California, Berkeley...t5 t6 12 Concurrency, causality, choice Choice, conflict t1 t2 t3 t4 t5 t6 13 Concurrency, causality, choice Choice,

105

PNs Summary

• PN Graph: places (buffers), transitions (actions), tokens (data)

• Firing rule: transition enabled if there are enough tokens in each input place

• Properties

– Structural (consistency, structural boundedness…)

– Behavioral (reachability, boundedness, liveness…)

• Analysis techniques

– Structural (only CN or CS): State equations, Invariants

– Behavioral: coverability tree

• Reachability

• Subclasses: Marked Graphs, State Machines, Free-Choice PNs

2

Page 106: EE249 7 mocPetri BW.ppt - University of California, Berkeley...t5 t6 12 Concurrency, causality, choice Choice, conflict t1 t2 t3 t4 t5 t6 13 Concurrency, causality, choice Choice,

106

References

• T. Murata Petri Nets: Properties, Analysis and Applications

• http://www.informatik.uni- �hamburg.de/TGI/PetriNets/


Recommended