You are on page 1of 27

Chapter 3

Petri Nets
Chapter 3
Petri Nets
• 3.1 Simple Petri Nets
• 3.2  Extended Petri nets
Introduction
• Petri nets were developed to define the
coordination of asynchronous events.
• Petri nets are often used for describing
interdependence between and synchronization of
parallel processes.
• Definition
• A Petri net is a directed, bipartite (iki parçalı;ikili)
graph with tokens (markings)
• Every Petri net is consist of two sepearte types of
nodes (places and transitions).
• Between places and transitions run directed arcs.
• There are incoming and outgiong arcs to and from places.
• The places can be either free or marked (containing
tokens).
• The places with out going arcs to a transition t will be
known as source place of transition t
• Figure 2.2 (3.2) show a simple petri net
3.1 Simple Petri Nets

• The transition of the Petri net in Figure 3.2 is


enabled, since both places are marked.
• The concurrent firing of several transitions is notr
possible.
• This is illustrated in figure 3.4 where two different
outcomes are possible.
• If t1 in this example fires first, then t2 will no
longer be enabled; and if t2 fires first, then t1 will
no longer be enabled.
• Petri nets may be used to describe the
synchronization of asynchronously parallel
processes.
• This may be necessary to avoid deadlocks or
inconsistent data is case where two processes need
to access shared memory (see figure 3.7).
• Process P1 is a producer and process P2 is a
consumer.
• Processes must not be allowed to acces the buffer
areas simultaneously.
• Figure 3.8 shows a simple example of this
situation where two processes P1 and P2 are
synchronized in order to allow acces to shared
memory.
• Processes may be active or passive.
3.2 Extended Petri Nets

• Extensions
• The rules for firing and enabled transitions are
correspondingly adapted.
– A transition is enabled if and only if the number of
tokens in each of its sources is greather than or equal to
one.
– When a transition fires, the numbers of token in ecah of
its sources is decremented by one and the number
tokens in each of its drains is incremented by one.
• ii ) Inhibitory Arcs
• An inhibitory arc is a special kind of incomming arc and is
represented by a dot at the transition end of the arc (see
figure 3.9).
• The transition t is enabled, since p1 is marked and p2 is
unmarked.
• iii) Arc weights
• Each arc that is not an inhibitory arc may have a
constant integer weight greather than or equal to
one.
Extend Petri Net summary
• p denotes the number of tokens in place P
Petri net adder
• The first Petri net in figure 3.11 adds the token in
place Y to the tokens in place Z and calculates the
sum Z+Y.
• The stat place will be preset with a value of 1.
• After firing of transition s, this token disappear,
and a token appears in place finish.
Petri Net Subtractor
• A simple subs tractor (figure 3.12, left can be derived from
the adder (figure 3.11) by simply reversing the arrow to Z
Petri Net Multiplier
• The multiplier (figure 3.13) provides to be
somewhat complex.
Replication
• Figure 3.14 shows a general method of replicating
of a variable.
Sequential and Parallel Petri Nets
• i) Sequential processing
• ii) Parallel processing

You might also like