Slideshare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our User Agreement and Privacy Policy.

Slideshare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our Privacy Policy and User Agreement for details.

Like this presentation? Why not share!

- Petri nets by Barkatllah by Barkat Ullah 907 views
- Colored petri nets theory and appli... by Abu Hussein 2894 views
- A petri-net by Omar Al-Sabek 393 views
- Petrinet by lovebot 861 views
- Pg student projects by suneel rathore 292 views
- A modified reach ability tree appro... by Anirudh Kadevari 235 views

No Downloads

Total views

1,170

On SlideShare

0

From Embeds

0

Number of Embeds

3

Shares

0

Downloads

48

Comments

0

Likes

2

No embeds

No notes for slide

Distributed scheme -- idea: make equivalence classes via input relation x~y if {x,y} in I(a) some a.

- 1. 10. Petri Nets Prof. O. Nierstrasz
- 2. Petri Nets Roadmap > Definition: — places, transitions, inputs, outputs — firing enabled transitions > Modelling: — concurrency and synchronization > Properties of nets: — liveness, boundedness > Implementing Petri net models: — centralized and decentralized schemes © Oscar Nierstrasz J. L. Peterson, Petri Nets Theory and the Modelling of Systems, Prentice Hall, 1983. 2
- 3. Petri Nets Roadmap > Definition: — places, transitions, inputs, outputs — firing enabled transitions > Modelling: — concurrency and synchronization > Properties of nets: — liveness, boundedness > Implementing Petri net models: — centralized and decentralized schemes © Oscar Nierstrasz 3
- 4. Petri Nets Petri nets: a definition A Petri net C = 〈P,T,I,O〉 consists of: 1. 2. 3. 4. A finite set P of places A finite set T of transitions An input function I: T → NatP (maps to bags of places) An output function O: T → NatP A marking of C is a mapping m: P → Nat Example: P = { x, y } T = { a, b } I(a) = { x }, I(b) = { x, x } O(a) = { x, y }, O(b) = { y } m = { x, x } © Oscar Nierstrasz a x b y 4
- 5. Petri Nets Firing transitions To fire a transition t: t must be enabled: m ≥ I(t) consume inputs and generate output: m′= m - I(t) + O(t) 1. 2. a b © Oscar Nierstrasz a b b 5
- 6. Petri Nets Roadmap > Definition: — places, transitions, inputs, outputs — firing enabled transitions > Modelling: — concurrency and synchronization > Properties of nets: — liveness, boundedness > Implementing Petri net models: — centralized and decentralized schemes © Oscar Nierstrasz 6
- 7. Petri Nets Modelling with Petri nets Petri nets are good for modelling: > concurrency > synchronization Tokens can represent: > resource availability > jobs to perform > flow of control > synchronization conditions ... © Oscar Nierstrasz 7
- 8. Petri Nets Concurrency Independent inputs permit “concurrent” firing of transitions © Oscar Nierstrasz 8
- 9. Petri Nets Conflict Overlapping inputs put transitions in conflict a b Only one of a or b may fire © Oscar Nierstrasz 9
- 10. Petri Nets Mutual Exclusion The two subnets are forced to synchronize © Oscar Nierstrasz 10
- 11. Petri Nets Fork and Join © Oscar Nierstrasz 11
- 12. Petri Nets Producers and Consumers producer © Oscar Nierstrasz consumer 12
- 13. Petri Nets Bounded Buffers #occupied slots #free slots © Oscar Nierstrasz 13
- 14. Petri Nets Roadmap > Definition: — places, transitions, inputs, outputs — firing enabled transitions > Modelling: — concurrency and synchronization > Properties of nets: — liveness, boundedness > Implementing Petri net models: — centralized and decentralized schemes © Oscar Nierstrasz 14
- 15. Petri Nets Reachability and Boundedness Reachability: > The reachability set R(C,µ) of a net C is the set of all markings µ′ reachable from initial marking m. Boundedness: > A net C with initial marking µ is safe if places always hold at most 1 token. > A marked net is (k-)bounded if places never hold more than k tokens. > A marked net is conservative if the number of tokens is constant. © Oscar Nierstrasz 15
- 16. Petri Nets Liveness and Deadlock Liveness: > A transition is deadlocked if it can never fire. > A transition is live if it can never deadlock. This net is both safe and conservative. Transition a is deadlocked. x Transitions b and c are live. The reachability set is {{y}, {z}}. b a y c z Are the examples we have seen bounded? Are they live? © Oscar Nierstrasz 16
- 17. Petri Nets Related Models Finite State Processes > Equivalent to regular expressions > Can be modelled by one-token conservative nets b a d The FSA for: a(b|c)*d c © Oscar Nierstrasz 17
- 18. Petri Nets Finite State Nets Some Petri nets can be modelled by FSPs a {u,w} v u c {v,w} b {u,x} c x w b a b a {v,x} Precisely which nets can (cannot) be modelled by FSPs? © Oscar Nierstrasz 18
- 19. Petri Nets Zero-testing Nets Petri nets are not computationally complete > Cannot model “zero testing” > Cannot model priorities b A zero-testing net: An equal number of a and b transitions may fire as a sequence during any sequence of matching c and d transitions. (#a ≥ #b, #c ≥ #d) © Oscar Nierstrasz a c d 19
- 20. Petri Nets Other Variants There exist countless variants of Petri nets Coloured Petri nets: > Tokens are “coloured” to represent different kinds of resources Augmented Petri nets: > Transitions additionally depend on external conditions Timed Petri nets: > A duration is associated with each transition © Oscar Nierstrasz 20
- 21. Petri Nets Applications of Petri nets Modelling information systems: > Workflow > Hypertext (possible transitions) > Dynamic aspects of OODB design © Oscar Nierstrasz 21
- 22. Petri Nets Roadmap > Definition: — places, transitions, inputs, outputs — firing enabled transitions > Modelling: — concurrency and synchronization > Properties of nets: — liveness, boundedness > Implementing Petri net models: — centralized and decentralized schemes © Oscar Nierstrasz 22
- 23. Petri Nets Implementing Petri nets We can implement Petri net structures in either centralized or decentralized fashion: Centralized: > A single “net manager” monitors the current state of the net, and fires enabled transitions. Decentralized: > Transitions are processes, places are shared resources, and transitions compete to obtain tokens. © Oscar Nierstrasz 23
- 24. Petri Nets Centralized schemes In one possible centralized scheme, the Manager selects and fires enabled transitions. Concurrently enabled transitions can be fired in parallel. What liveness problems can this scheme lead to? © Oscar Nierstrasz 24
- 25. Petri Nets Decentralized schemes In decentralized schemes transitions are processes and tokens are resources held by places: x a y x b a y get() b Transitions can be implemented as thread-per-message gateways so the same transition can be fired more than once if enough tokens are available. © Oscar Nierstrasz 25
- 26. Petri Nets Transactions Transitions attempting to fire must grab their input tokens as an atomic transaction, or the net may deadlock even though there are enabled transitions! b x y a If a and b are implemented by independent processes, and x and y by shared resources, this net can deadlock even though b is enabled if a (incorrectly) grabs x and waits for y. © Oscar Nierstrasz 26
- 27. Petri Nets Coordinated interaction A simple solution is to treat the state of the entire net as a single, shared resource: b x y a get() a b After a transition fires, it notifies waiting transitions. How could you refine this scheme for a distributed setting? © Oscar Nierstrasz CP 12.27
- 28. Petri Nets Petit Petri — a Petri Net Editor built with Etoys 28
- 29. Petri Nets Etoys implementation © Oscar Nierstrasz 29
- 30. Petri Nets Etoys implementation Mouse down Mouse up © Oscar Nierstrasz 30
- 31. Petri Nets Examples © Oscar Nierstrasz 31
- 32. Petri Nets What you should know! > > > > > > How are Petri nets formally specified? How can nets model concurrency and synchronization? What is the “reachability set” of a net? How can you compute this set? What kinds of Petri nets can be modelled by finite state processes? How can a (bad) implementation of a Petri net deadlock even though there are enabled transitions? If you implement a Petri net model, why is it a good idea to realize transitions as “thread-per-message gateways”? © Oscar Nierstrasz CP 12.32
- 33. Petri Nets Can you answer these questions? > What are some simple conditions for guaranteeing that a net is bounded? > How would you model the Dining Philosophers problem as a Petri net? Is such a net bounded? Is it conservative? Live? > What could you add to Petri nets to make them Turingcomplete? > What constraints could you put on a Petri net to make it fair? © Oscar Nierstrasz CP 12.33
- 34. Petri Nets License http://creativecommons.org/licenses/by-sa/2.5/ Attribution-ShareAlike 2.5 Y ou are free: • to copy, distribute, display, and perform the work • to make derivative works • to make commercial use of the work Under the following conditions: Attribution. You must attribute the work in the manner specified by the author or licensor. Share Alike. If you alter, transform, or build upon this work, you may distribute the resulting work only under a license identical to this one. • For any reuse or distribution, you must make clear to others the license terms of this work. • Any of these conditions can be waived if you get permission from the copyright holder. Y our fair use and other rights are in no way affected by the above. © Oscar Nierstrasz 34

No public clipboards found for this slide

×
### Save the most important slides with Clipping

Clipping is a handy way to collect and organize the most important slides from a presentation. You can keep your great finds in clipboards organized around topics.

Be the first to comment