Вы находитесь на странице: 1из 15

Petri Nets

Presented By: Vaibhav Kumar(IMB2012036) Sneha Shah(IMB2012005) Vikas Gupta(IMB2012039)

Introduction
First introduced by Carl Adam Petri in 1962. A diagrammatic tool to model concurrency and synchronization in distributed systems. Very similar to State Transition Diagrams. Used as a visual communication aid to model the system behavior. Based on graphical representation & strong mathematical foundation.

Introduction
A Petri net is one of several mathematical modelling languages for the description of distributed systems. It is also known as a place/transition net or P/T net. A Petri net is a directed bipartite graph, in which the nodes represent transitions and places. The directed arcs describe which places are pre- and/or post conditions for which transitions occurs. 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.

Petri Net Elements


A Petri net consists of: Places
Represent conditions Signified by circles They represent events that may occur Signified by rectangle or thick bars. Arcs run from a condition (place) to a event (transition) or vice versa Arcs never exist between places or between transitions. Signified by arrows. If an arc goes from a condition to an event, then this means that the condition is necessary for the occurrence of the event. In this case we say that we have a precondition. Similarly, an arc from an event to a condition means that the occurrence of the event makes this condition true, and it is called a post-condition. Represented by solid dots.

Transitions:

Arcs:

Tokens:

Petri Net Elements (cont.)


(name) place

(name)

transition

arc (directed connection) token

Tokens
Tokens reside on places. A transition is enabled if there is a token in each of its input places. Although the structure of Petri nets is fixed the tokens may change their position according to firing rules. The movement of the tokens in the Petri net according to firing rules is called token play.

A simple example of petri net can be-

P2 where P1 & P2 are two places and T1 is one transaction


P1 T1

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. A transition of a Petri net may fire whenever there are sufficient tokens at the start of all input arcs. When it fires, it consumes these tokens, and places tokens at the end of all output arcs

Properties of Petri Nets


Sequential Execution
Transition T2 can fire only after the firing of T1. This impose the precedence of constraints T2 after T1."

P1

T1

P2

T2

P3

Synchronization
Transition T1 will be enabled only when there is at least one token at each of its input places.

Merging
Happens when tokens from several places arrive for service at the same transition.

T1

Concurrency
T1 and T2 are concurrent. With this property, Petri net is able to model systems of distributed control with multiple processes executing concurrently in time.

t1
t2

Conflict
T1 and T2 are both ready to fire but the firing of any leads to the disabling of the other transitions.

t1
t2

t1
t2

Example

Fig: Sample Petri net representing single process instance

A Petri net is a tuple (P, T, F) with A finite set P of places A finite set T of transitions such that T P = and A flow relation F (P T) (T P) A place p 2 P is an input place of a transition t 2 T if and only if there exists a directed arc from p to t, i.e., if and only if (p, t) 2 F. The set of input places for a transition t is denoted t. A place p is an output place of a transition t if and only if there exists a directed arc from t to p, i.e., if and only if (t, p) 2 F. The set of output places for a transition t is denoted t. p and p denote the sets of transitions that share p as input places and output places, respectively.

Graphical representations of Petri nets can be mapped onto a tuple (P, T, F), and vice versa. For instance, the Petri net shown in Figure 4.27 can be represented by (P, T, F) such that P = {p1, p2, p3, p4, p5, p6, p7}, T = {t1, t2, t3, t4, t5}, F = {(p1, t1), (t1, p2), (p2, t2), (t2, p3), (t2, p4), (p3, t3), (p4, t4), (t3, p5), (t4, p6), (p5, t5), (p6, t5), (t5, p7)}.

Applications of Petri Net


Petri net is primarily used for studying the dynamic concurrent behavior of network-based systems where there is a discrete flow. Petri Nets are applied in practice by industry, academics, and other places.

Вам также может понравиться