1 / 174

Petri Nets

Petri Nets. Marco Sgroi (sgroi@eecs.berkeley.edu) EE249 - Fall 2002. Outline. Petri nets Introduction Examples Properties Analysis techniques. Petri Nets (PNs). Model introduced by C.A. Petri in 1962 Ph.D. Thesis: “Communication with Automata”

ivy
Download Presentation

Petri Nets

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Petri Nets Marco Sgroi (sgroi@eecs.berkeley.edu) EE249 - Fall 2002

  2. Outline • Petri nets • Introduction • Examples • Properties • Analysis techniques

  3. 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 • Asynchronous model (partial ordering) • Main drawback: no hierarchy

  4. Petri Net Graph • Bipartite weighted directed graph: • Places: circles • Transitions: bars or boxes • Arcs: arrows labeled with weights • Tokens: black dots p2 t2 2 t1 p1 p4 3 t3 p3

  5. 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. p2 t2 2 t1 p1 p4 3 Places/Transition: conditions/events t3 p3

  6. 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 2 2 3 3

  7. Concurrency, causality, choice t1 t2 t5 t3 t4 t6

  8. Concurrency, causality, choice t1 Concurrency t2 t5 t3 t4 t6

  9. Concurrency, causality, choice t1 t2 t5 Causality, sequencing t3 t4 t6

  10. Concurrency, causality, choice t1 t2 t5 Choice, conflict t3 t4 t6

  11. Concurrency, causality, choice t1 t2 t5 Choice, conflict t3 t4 t6

  12. Communication Protocol Send msg Receive msg P2 P1 Send Ack Receive Ack

  13. Communication Protocol Send msg Receive msg P2 P1 Send Ack Receive Ack

  14. Communication Protocol Send msg Receive msg P2 P1 Send Ack Receive Ack

  15. Communication Protocol Send msg Receive msg P2 P1 Send Ack Receive Ack

  16. Communication Protocol Send msg Receive msg P2 P1 Send Ack Receive Ack

  17. Communication Protocol Send msg Receive msg P2 P1 Send Ack Receive Ack

  18. Producer-Consumer Problem Produce Buffer Consume

  19. Producer-Consumer Problem Produce Buffer Consume

  20. Producer-Consumer Problem Produce Buffer Consume

  21. Producer-Consumer Problem Produce Buffer Consume

  22. Producer-Consumer Problem Produce Buffer Consume

  23. Producer-Consumer Problem Produce Buffer Consume

  24. Producer-Consumer Problem Produce Buffer Consume

  25. Producer-Consumer Problem Produce Buffer Consume

  26. Producer-Consumer Problem Produce Buffer Consume

  27. Producer-Consumer Problem Produce Buffer Consume

  28. Producer-Consumer Problem Produce Buffer Consume

  29. Producer-Consumer Problem Produce Buffer Consume

  30. Producer-Consumer Problem Produce Buffer Consume

  31. Producer-Consumer Problem Produce Buffer Consume

  32. Producer-Consumer with priority A Consumer B can consume only if buffer A is empty Inhibitor arcs B

  33. 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

  34. Reachability • Marking M is reachable from marking M0 if there exists a sequence of firingss = M0 t1 M1 t2 M2… M that transforms M0 to M. • The reachability problem is decidable. p2 t2 M0 = (1,0,1,0) t3 M1 = (1,0,0,1) t2 M = (1,1,0,0) p1 t1 p4 t3 p3 M0 = (1,0,1,0) M = (1,1,0,0)

  35. Liveness • Liveness: from any marking any transition can become fireable • Liveness implies deadlock freedom, not viceversa Not live

  36. Liveness • Liveness: from any marking any transition can become fireable • Liveness implies deadlock freedom, not viceversa Not live

  37. Liveness • Liveness: from any marking any transition can become fireable • Liveness implies deadlock freedom, not viceversa Deadlock-free

  38. Liveness • Liveness: from any marking any transition can become fireable • Liveness implies deadlock freedom, not viceversa Deadlock-free

  39. Boundedness • 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) Unbounded

  40. Boundedness • 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) Unbounded

  41. Boundedness • 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) Unbounded

  42. Boundedness • 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) Unbounded

  43. Boundedness • 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) Unbounded

  44. Conservation • Conservation: the total number of tokens in the net is constant Not conservative

  45. Conservation • Conservation: the total number of tokens in the net is constant Not conservative

  46. Conservation • Conservation: the total number of tokens in the net is constant Conservative 2 2

  47. Analysis techniques • Structural analysis techniques • Incidence matrix • T- and S- Invariants • State Space Analysis techniques • Coverability Tree • Reachability Graph

  48. -1 0 0 1 1 -1 0 -1 1 A= Incidence Matrix t2 p1 t1 p2 p3 • Necessary condition for marking M to be reachable from initial marking M0: there exists firing vector v s.t.: M = M0 + A v t1 t2 t3 p1 t3 p2 p3

  49. p1 t1 p2 p3 -1 0 0 1 1 -1 0 -1 1 A= t3 1 0 1 0 0 1 1 0 0 -1 0 0 1 1 -1 0 -1 1 1 0 1 = + v1 = State equations t2 • 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

  50. Necessary Condition only t2 t3 t1 2 2 Firing vector: (1,2,2) Deadlock!!

More Related