ArticleslgStudy

computer science

Petri net

Petri net is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Petri net rather than just read about it. In short: A Petri net, also known as a place/transition net (PT net), is one of several mathematical modeling languages for the description of distributed systems. It is a class of discrete event dynamic system.

Petri net — main illustration
Petri net — illustration

Key takeaways

  • Petri net belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Petri net to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Petri net from memory before moving on to harder problems.

Reference excerpt

A Petri net, also known as a place/transition net (PT net), is one of several mathematical modeling languages for the description of distributed systems. It is a class of discrete event dynamic system. A Petri net is a directed bipartite graph that has two types of elements: places and transitions. Place elements are depicted as white circles and transition elements are depicted as rectangles. A place can contain any number of tokens, depicted as black circles. A transition is enabled if all places connected to it as inputs contain at least one token. Like industry standards such as UML activity diagrams, Business Process Model and Notation, and event-driven process chains, Petri nets offer a graphical notation for stepwise processes that include choice, iteration, and concurrent execution. Unlike these standards, Petri nets have an exact mathematical definition of their execution semantics, with a well-developed mathematical theory for process analysis.

Historical background The German computer scientist Carl Adam Petri, after whom such structures are named, analyzed Petri nets extensively in his 1962 Ph. D. dissertation (Petri 1962). An English translation was published in 1966 (Petri 1966). Despite this, Petri may have invented them in 1939 to describe chemical processes.

Petri net basics A Petri net consists of places, transitions, and arcs. Arcs run from a place to a transition or vice versa, never between places or between transitions. The places from which an arc runs to a transition are called the input places of the transition; the places to which arcs run from a transition are called the output places of the transition. Graphically, places in a Petri net may contain a discrete number of marks called tokens. Any distribution of tokens over the places will represent a configuration of the net called a marking. In an abstract sense relating to a Petri net diagram, a transition of a Petri net may fire if it is enabled, i.e. there are sufficient tokens in all of its input places; when the transition fires, it consumes the required input tokens, and creates tokens in its output places. A firing is atomic, i.e. a single non-interruptible step. Unless an execution policy (e.g. a strict ordering of transitions, describing precedence) is defined, the execution of Petri nets is nondeterministic: when multiple transitions are enabled at the same time, they will fire in any order. Since firing is nondeterministic, and multiple tokens may be present anywhere in the net (even in the same place), Petri nets are well suited for modeling the concurrent behavior of distributed systems.

Formal definition and basic terminology Petri nets are state-transition systems that extend a class of nets called elementary nets. Definition 1. A net is a tuple N = ( P , T , F ) {\displaystyle N=(P,T,F)} where

P and T are disjoint finite sets of places and transitions, respectively.

F ⊆ ( P × T ) ∪ ( T × P ) {\displaystyle F\subseteq (P\times T)\cup (T\times P)} is a set of (directed) arcs (or flow relations). Definition 2. Given a net N = (P, T, F), a configuration is a set C so that C ⊆ P.

Definition 3. An elementary net is a net of the form EN = (N, C) where

N = (P, T, F) is a net. C is such that C ⊆ P is a configuration. Definition 4. A Petri net is a net of the form PN = (N, M, W), which extends the elementary net so that

N = (P, T, F) is a net. M: P → Z is a place multiset, where Z is a countable set. M extends the concept of configuration and is commonly described with reference to Petri net diagrams as a marking. W: F → Z is an arc multiset, so that the count (or weight) for each arc is a measure of the arc multiplicity. If a Petri net is equivalent to an elementary net, then Z can be the countable set {0,1} and those elements in P that map to 1 under M form a configuration. Similarly, if a Petri net is not an elementary net, then the multiset M can be interpreted as representing a non-singleton set of configurations. In this respect, M extends the concept of configuration for elementary nets to Petri nets. In the diagram of a Petri net (see top figure right), places are conventionally depicted with circles, transitions with long narrow rectangles and arcs as one-way arrows that show connections of places to transitions or transitions to places. If the diagram were of an elementary net, then those places in a configuration would be conventionally depicted as circles, where each circle encompasses a single dot called a token. In the given diagram of a Petri net (see right), the place circles may encompass more than one token to show the number of times a place appears in a configuration. The configuration of tokens distributed over an entire Petri net diagram is called a marking. In the top figure (see right), the place p1 is an input place of transition t; whereas, the place p2 is an output place to the same transition. Let PN0 (top figure) be a Petri net with a marking configured M0, and PN1 (bottom figure) be a Petri net with a marking configured M1. The configuration of PN0 enables transition t through the property that all input places have sufficient number of tokens (shown in the figures as dots) "equal to or greater" than the multiplicities on their respective arcs to t. Once and only once a transition is enabled will the transition fire. In this example, the firing of transition t generates a map that has the marking configured M1 in the image of M0 and results in Petri net PN1, seen in the bottom figure. In the diagram, the firing rule for a transition can be characterised by subtracting a number of tokens from its input places equal to the multiplicity of the respective input arcs and accumulating a new number of tokens at the output places equal to the multiplicity of the respective output arcs. Remark 1. The precise meaning of "equal to or greater" will depend on the precise algebraic properties of addition being applied on Z in the firing rule, where subtle variations on the algebraic properties can lead to other classes of Petri nets; for example, algebraic Petri nets. The following formal definition is loosely based on (Peterson 1981). Many alternative definitions exist.

… excerpt ends here. Continue reading the full article.

Illustrations

Petri net: (a) Petri net trajectory example
(a) Petri net trajectory example
Petri net: A Petri net with an enabled transition.
A Petri net with an enabled transition.
Petri net: The Petri net that follows after the transition fires (Initial Petri net in the figure above).
The Petri net that follows after the transition fires (Initial Petri net in the figure above).
Petri net: (b) Petri net example
(b) Petri net example
Petri net: A Petri net in which transition 
  
    
      
        
          t
          
            0
          
        
      
    
    {\displaystyle t_{0}}
  
 is dead, while for all 
  
    
      
        j
        >
        0
        ,
      
    
    {\displaystyle j>0,}
  
 
  
    
      
        
          t
          
            j
          
        
      
    
    {\displaystyle t_{j}}
  
 is 
  
    
      
        
          L
          
            j
          
        
      
    
    {\displaystyle L_{j}}
  
-live
A Petri net in which transition t 0 {\displaystyle t_{0}} is dead, while for all j > 0 , {\displaystyle j>0,} t j {\displaystyle t_{j}} is L j {\displaystyle L_{j}} -live

Worked examples

Example 1 — a first encounter with Petri net

Start with the simplest possible case. Write down what Petri net claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Petri net before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Petri net ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Petri net

In research
Petri net appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Petri net in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Petri net is common in secondary-school and first-year university syllabi. It links to neighbouring topics Concurrency (computer science), Eponymous diagrams, Formal specification languages, so understanding it makes those chapters shorter.
In everyday life
Look for Petri net outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Petri net” →

Affiliate

Preply — study more efficiently by working with a personal tutor. 50% off.

How to study Petri net in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Petri net means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Petri net out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Petri net in simple terms?

A Petri net, also known as a place/transition net (PT net), is one of several mathematical modeling languages for the description of distributed systems. It is a class of discrete event dynamic system.

Why does Petri net matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Petri net?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Petri net.

Tags

  • Concurrency (computer science)
  • Eponymous diagrams
  • Formal specification languages
  • Modeling languages
  • Models of computation
  • Petri nets
  • Software modeling language

Keep exploring