**2. Preliminaries**

This section briefly touches some fundamental concepts as a basis for a better understanding of this work.

©2012 Callou et al., licensee InTech. This is an open access chapter distributed under the terms of the Creative Commons Attribution License (http://creativecommons.org/licenses/by/3.0),which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited. ©2012 Callou et al., licensee InTech. This is a paper distributed under the terms of the Creative Commons Attribution License (http://creativecommons.org/licenses/by/3.0), which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.

## **2.1. Petri nets**

Petri nets (PN) were introduced in 1962 by the PhD dissertation of Carl Adams Petri [16], at Technical University of Darmstandt, Germany. The original theory was developed as an approach to model and analyze communication systems. Petri Nets (PNs) [14] are a graphic and mathematical modeling tool that can be applied in several types of systems and allow the modeling of parallel, concurrent, asynchronous and non-deterministic systems. Since its seminal work, many representations and extensions have been proposed for allowing more concise descriptions and for representing systems feature not observed on the early models. Thus, the simple Petri net has subsequently been adapted and extended in several directions, in which timed, stochastic, high-level, object-oriented and coloured nets are a few examples of the proposed extensions.

**Figure 2.** Compact representation of a PN

**Table 1.** Interpretation for places and transitions.

and the set of output transitions (also called post-set) is:

and the set of output places of a transition *tj* ∈ *T* is:

called pre-set) of a place *pi* ∈ *P* is:

*tj* ∈ *T* is:

Input Places Transitions Output Places pre-conditions events post-conditions input data computation step output data input signals signal processor output signals resource needed tasks resource releasing conditions logical clauses conclusions buffers processor buffers

A Petri Net-Based Approach to the Quanti cation of Data Center Dependability 315

It is important to show that there are another way to represent PN's elements. As an example, the set of input and output places of transitions is shown in Definition 2.2. Similarly, the set of

**Definition 2.2. (Input and Output Transitions of a place)** The set of input transitions (also

label = •*pi* = {*tj* ∈ *T*|(*tj*, *pi*) ∈ *F*}.

label = *pi*• = {*tj* ∈ *T*|(*pi*, *tj*) ∈ *F*}.

**Definition 2.3. (Input and output places of a transition)** The set of input places of a transition

label = •*tj* = {*pi* ∈ *P*|(*pi*, *tj*) ∈ *F*}.

label = *tj*• = {*pi* ∈ *P*|(*tj*, *pi*) ∈ *F*}.

input and output transitions of determinate place is shown in Definition 2.3.

## **2.2. Place-Transition nets**

Place/Transition Petri nets are one of the most prominent and best studied class of Petri nets, and it is sometimes called just by Petri net (PN). A marked Place/Transition Petri net is a bipartite directed graph, usually defined as follows:

**Definition 2.1. (Petri net)** A Petri net [14] is a 5-tuple:

$$PN = (P\_{\prime} \, T\_{\prime} \, F\_{\prime} \, W\_{\prime} M\_0)$$

where:


This class of Petri net has two kinds of nodes, called places (*P*) represented by circles and transitions (*T*) represented by bars, such that *P* ∩ *T* = and *P* ∪ *T* �= . Figure 1 depicts the basic elements of a simple PN. The set of arcs *F* is used to denote the places connected to a transition (and vice-versa). *W* is a weight function for the set of arcs. In this case, each arc is said to have multiplicity k, where k represents the respective weight of the arc. Figure 2 shows multiple arcs connecting places and transitions in a compact way by a single arc labeling it with its weight or multiplicity k.

**Figure 1.** Petri net basic elements.

Places and transitions may have several interpretations. Using the concept of conditions and events, places represent conditions, and transitions represent events, such that, an event may have several pre-conditions and post-conditions. For more interpretations, Table 1 shows other meanings for places and transitions [14].

314 Petri Nets – Manufacturing and Computer Science A Petri Net-Based Approach to the Quantification of Data Center Dependability <sup>3</sup> A Petri Net-Based Approach to the Quanti cation of Data Center Dependability 315

**Figure 2.** Compact representation of a PN

2 Petri Nets

Petri nets (PN) were introduced in 1962 by the PhD dissertation of Carl Adams Petri [16], at Technical University of Darmstandt, Germany. The original theory was developed as an approach to model and analyze communication systems. Petri Nets (PNs) [14] are a graphic and mathematical modeling tool that can be applied in several types of systems and allow the modeling of parallel, concurrent, asynchronous and non-deterministic systems. Since its seminal work, many representations and extensions have been proposed for allowing more concise descriptions and for representing systems feature not observed on the early models. Thus, the simple Petri net has subsequently been adapted and extended in several directions, in which timed, stochastic, high-level, object-oriented and coloured nets are a few examples

Place/Transition Petri nets are one of the most prominent and best studied class of Petri nets, and it is sometimes called just by Petri net (PN). A marked Place/Transition Petri net is a

*PN* = (*P*, *T*, *F*,*W*, *M*0)

This class of Petri net has two kinds of nodes, called places (*P*) represented by circles and transitions (*T*) represented by bars, such that *P* ∩ *T* = and *P* ∪ *T* �= . Figure 1 depicts the basic elements of a simple PN. The set of arcs *F* is used to denote the places connected to a transition (and vice-versa). *W* is a weight function for the set of arcs. In this case, each arc is said to have multiplicity k, where k represents the respective weight of the arc. Figure 2 shows multiple arcs connecting places and transitions in a compact way by a single arc labeling it with its

Places and transitions may have several interpretations. Using the concept of conditions and events, places represent conditions, and transitions represent events, such that, an event may have several pre-conditions and post-conditions. For more interpretations, Table 1 shows

**2.1. Petri nets**

of the proposed extensions.

**2.2. Place-Transition nets**

where:

bipartite directed graph, usually defined as follows: **Definition 2.1. (Petri net)** A Petri net [14] is a 5-tuple:

1. *P* = {*p*1, *p*2, ..., *pm*} is a finite set of places; 2. *T* = {*t*1, *t*2, ...,*tn*} is a finite set of transitions;

4. *W* : *F* →{1, 2, 3, ...} is a weight function; 5. *M*<sup>0</sup> : *P* → {0, 1, 2, 3, ...} is the initial marking;

weight or multiplicity k.

**Figure 1.** Petri net basic elements.

other meanings for places and transitions [14].

3. *F* ⊆ (*P* × *T*) ∪ (*T* × *P*) is a set of arcs (flow relation);


**Table 1.** Interpretation for places and transitions.

It is important to show that there are another way to represent PN's elements. As an example, the set of input and output places of transitions is shown in Definition 2.2. Similarly, the set of input and output transitions of determinate place is shown in Definition 2.3.

**Definition 2.2. (Input and Output Transitions of a place)** The set of input transitions (also called pre-set) of a place *pi* ∈ *P* is:

$$\text{label} = \bullet p\_i = \{ t\_j \in T | (t\_{j'} p\_i) \in F \}.$$

and the set of output transitions (also called post-set) is:

$$\text{label} = p\_i \\ \bullet = \{ t\_j \in T | (p\_{i\nu} t\_j) \in F \}.$$

**Definition 2.3. (Input and output places of a transition)** The set of input places of a transition *tj* ∈ *T* is:

$$\text{label} = \bullet \\ t\_{\slash} = \{ p\_i \in P | (p\_{i\prime} t\_{\not\choose j}) \in F \}.$$

and the set of output places of a transition *tj* ∈ *T* is:

$$\text{label} = t\_{\hat{j}} \bullet = \{ p\_i \in P | (t\_{j'} p\_i) \in F \}.$$

### *2.2.1. Marked Petri nets*

A marking (also named token) has a primitive concept in PNs such as place and transitions. Markings are information attributed to places; the number and mark distributions consist of the net state in determined moment. The formal definitions are presented as follows.

outlines its respective graphical representation, and Figure 3 (c) provides the same graphical representation after the firing of *t*0. For this example, the set of reachable markings is m = {*m*<sup>0</sup> = (3, 1, 0), *m*<sup>1</sup> = (1, 0, 2)}. The marking *m*<sup>1</sup> was obtained by firing *t*0, such that, *m*1(*p*0) =

A Petri Net-Based Approach to the Quanti cation of Data Center Dependability 317

**Figure 3.** (a) Mathematical formalism; (b) Graphical representation before the firing of *t*0; (c) Graphical

There are two particular cases which the firing rule happens differently. The first one is a transition without any input place that is called as a *source* transition, and the other one is a transition without any output place, named *sink* transition. A *source* transition is unconditionally enabled, and the firing of a *sink* transition consumes tokens, but does not produce any. Figure 4 (a) shows a *source* transition, and Figure (b) 4 depicts a *sink* transition.

**Definition 2.7. (Source transitions)** A transition is said to be source if, and only if, *I*(*p*, *t*) = 0,

**Definition 2.8. (Sink transitions)** A transition is said to be sink if, and only if, *O*(*p*, *t*) = 0,

**Definition 2.9. (Inhibitor arc)** Originally not present in PN, the introduction of the concept of inhibitor arc increases the modeling power of PN, adding the ability of testing if a place does not have tokens. In the presence of an inhibitor arc, a transition is enabled to fire if each input place connected by a normal arc has a number of tokens equal to the arc weight, and if each input place connected by an inhibitor arc has no tokens. Figure 5 illustrates an inhibitor arc connecting the input place *p*<sup>0</sup> to the transition *t*0, which is denoted by an arc finished with a

In both, the markings are represented before and after their respective firing.

3 - 2 + 0, *m*1(*p*1) = 1 - 1 + 0, and *m*1(*p*2) = 0 - 0 + 2.

representation after the firing of *t*0.

**Figure 4.** (a) *Source* transitions; (b) *Sink* transitions.

small circle. In such Figure, the transition *t*<sup>0</sup> is enabled to fire.

∀*p* ∈ *P*.

∀*p* ∈ *P*.

**Definition 2.4. (Marking)** Considering the set of places *P* in a net *N*, the formal definition of marking is represented by a function that maps the set of places P into non negative integers *M* : *P* → **N**.

**Definition 2.5. (Marking vector)** Considering the set of places *P* in a net *N*, the marking can be defined as a vector *M* = (*M*(*p*1), ..., *M*(*pn*)), where *n* = #(*P*), ∀*pi* ∈ *P* / *M*(*pi*) ∈ **N**. Thus, such vector gives the number of tokens in each place for the marking *Mi*.

**Definition 2.6. (Marked net)** A marked Petri net is defined by a tupla *NM* = (*N*; *M*0), where

*N* is the net structure and *M*<sup>0</sup> is the initial marking.

A marked Petri net contains tokens, which reside in places, travel along arcs, and their flow through the net is regulated by transitions. A peculiar distribution (M) of the tokens in the places, represents a specific state of the system. These tokens are denoted by black dots inside the places as shown in Figure 1 (d).

### *2.2.2. Transition enabling and firing*

The behavior of many systems can be described in terms of system states and their changes. In order to simulate the dynamic behavior of a system, a state (or marking) in a Petri net is changed according to the following firing rule:


Figure 3 (a) shows the mathematical representation of a Petri net model with three places (*p*0, *p*1, *p*2) and one transition (*t*0). Besides, there is one arc connecting the place *p*<sup>0</sup> to the transition *t*<sup>0</sup> with weight two, one arc from the place *p*<sup>1</sup> to the transition *t*<sup>0</sup> with weight one, and one arc connecting the transition *t*<sup>0</sup> to the place *p*<sup>2</sup> with weight two. The initial marking (*m*0) is represented by three tokens in the place *p*<sup>0</sup> and one token in the place *p*1. Figure 3 (b) outlines its respective graphical representation, and Figure 3 (c) provides the same graphical representation after the firing of *t*0. For this example, the set of reachable markings is m = {*m*<sup>0</sup> = (3, 1, 0), *m*<sup>1</sup> = (1, 0, 2)}. The marking *m*<sup>1</sup> was obtained by firing *t*0, such that, *m*1(*p*0) = 3 - 2 + 0, *m*1(*p*1) = 1 - 1 + 0, and *m*1(*p*2) = 0 - 0 + 2.

**Figure 3.** (a) Mathematical formalism; (b) Graphical representation before the firing of *t*0; (c) Graphical representation after the firing of *t*0.

There are two particular cases which the firing rule happens differently. The first one is a transition without any input place that is called as a *source* transition, and the other one is a transition without any output place, named *sink* transition. A *source* transition is unconditionally enabled, and the firing of a *sink* transition consumes tokens, but does not produce any. Figure 4 (a) shows a *source* transition, and Figure (b) 4 depicts a *sink* transition. In both, the markings are represented before and after their respective firing.

**Figure 4.** (a) *Source* transitions; (b) *Sink* transitions.

4 Petri Nets

A marking (also named token) has a primitive concept in PNs such as place and transitions. Markings are information attributed to places; the number and mark distributions consist of

**Definition 2.4. (Marking)** Considering the set of places *P* in a net *N*, the formal definition of marking is represented by a function that maps the set of places P into non negative integers

**Definition 2.5. (Marking vector)** Considering the set of places *P* in a net *N*, the marking can be defined as a vector *M* = (*M*(*p*1), ..., *M*(*pn*)), where *n* = #(*P*), ∀*pi* ∈ *P* / *M*(*pi*) ∈ **N**. Thus,

**Definition 2.6. (Marked net)** A marked Petri net is defined by a tupla *NM* = (*N*; *M*0), where

A marked Petri net contains tokens, which reside in places, travel along arcs, and their flow through the net is regulated by transitions. A peculiar distribution (M) of the tokens in the places, represents a specific state of the system. These tokens are denoted by black dots inside

The behavior of many systems can be described in terms of system states and their changes. In order to simulate the dynamic behavior of a system, a state (or marking) in a Petri net is

1. A transition *t* is said to be enabled, if each input place *p* of *t* is marked with at least the number of tokens equal to the multiplicity of its arc connecting p with *t*. Adopting a mathematical notation, an enabled transition *t* for given marking *mi* is denoted by *mi*[*t* >,

2. An enabled transition may or may not fire (depending on whether or not the respective

3. The firing of an enabled transition *t* removes tokens (equal to the multiplicity of the input arc) from each input place *p*, and adds tokens (equal to the multiplicity of the output

represented by the equation *mj*(*p*) = *mi*(*p*) − *W*(*p*, *t*) + *W*(*t*, *p*), ∀*p* ∈ *P*. If a marking *mj* is

Figure 3 (a) shows the mathematical representation of a Petri net model with three places (*p*0, *p*1, *p*2) and one transition (*t*0). Besides, there is one arc connecting the place *p*<sup>0</sup> to the transition *t*<sup>0</sup> with weight two, one arc from the place *p*<sup>1</sup> to the transition *t*<sup>0</sup> with weight one, and one arc connecting the transition *t*<sup>0</sup> to the place *p*<sup>2</sup> with weight two. The initial marking (*m*0) is represented by three tokens in the place *p*<sup>0</sup> and one token in the place *p*1. Figure 3 (b)

reachable from *mi* by firing a transition *t*, it is denoted by *mi*[*t* > *mj* .

. Using a mathematical notation, the firing of a transition is

the net state in determined moment. The formal definitions are presented as follows.

such vector gives the number of tokens in each place for the marking *Mi*.

*N* is the net structure and *M*<sup>0</sup> is the initial marking.

changed according to the following firing rule:

the places as shown in Figure 1 (d).

*2.2.2. Transition enabling and firing*

if *mi*(*pj*) ≥ *W*(*pj*, *t*), ∀*pj* ∈ *P*.

arc) to each output place *p*�

event takes place).

*2.2.1. Marked Petri nets*

*M* : *P* → **N**.

**Definition 2.7. (Source transitions)** A transition is said to be source if, and only if, *I*(*p*, *t*) = 0, ∀*p* ∈ *P*.

**Definition 2.8. (Sink transitions)** A transition is said to be sink if, and only if, *O*(*p*, *t*) = 0, ∀*p* ∈ *P*.

**Definition 2.9. (Inhibitor arc)** Originally not present in PN, the introduction of the concept of inhibitor arc increases the modeling power of PN, adding the ability of testing if a place does not have tokens. In the presence of an inhibitor arc, a transition is enabled to fire if each input place connected by a normal arc has a number of tokens equal to the arc weight, and if each input place connected by an inhibitor arc has no tokens. Figure 5 illustrates an inhibitor arc connecting the input place *p*<sup>0</sup> to the transition *t*0, which is denoted by an arc finished with a small circle. In such Figure, the transition *t*<sup>0</sup> is enabled to fire.

**Fork**

**Join**

**Choice**

**Merging**

the figure). **Confusions**

the end of predecessor processes.

will be in conflict with *t*<sup>3</sup> if *t*<sup>2</sup> fires first.

**Figure 8.** (a) symmetric confusion; (b) asymmetric confusion.

**2.4. Petri nets modeling examples**

Figure 7(b) shows an example of a fork structure that allows the creation of parallel processes.

A Petri Net-Based Approach to the Quanti cation of Data Center Dependability 319

Generally, concurrent activities need to synchronize with each other. This net (Figure 7(c)) combines two or more nets, allowing that another process continues this execution only after

Figure 7(d) depicts a choice model, in which the firing of the transition *t*0 disables the transition *t*1. This building block is suited for modeling if-then-else statement, for instance.

The merging is an elementary net that allows the enabling of the same transition by two or more processes. Figure 7(e) shows a net with two independent transitions (*t*<sup>0</sup> and *t*1) that have an output place in common (*P*2). Therefore, firing of any of these two transitions, a condition is created (*p*<sup>2</sup> is marked) which allows the firing of another transition (not shown in

The mixing between conflict and concurrency is called confusion. While conflict is a local phenomenon in the sense that only the pre-sets of the transitions with common input places are involved, confusion involves firing sequences. Figure 8 depicts two types of confusions: (a) symmetric confusion, where two transitions *t*<sup>1</sup> and *t*<sup>3</sup> are concurrent while each one is in conflict with transition *t*2; and (b) asymmetric confusion, where *t*<sup>1</sup> is concurrent with *t*2, but

In this section, several simple examples are given in order to introduce how to model some

basic concepts such as parallel process and mutual exclusion in Petri nets.

**Figure 5.** PN with an inhibitor arc.

**Definition 2.10. (Pure net)** A Petri net is said to be pure if it has no self-loops. A pair of a place *p* and transition *t* is called a self-loop if *p* is both an input and output place of *t*. Figure 6 shows a self-loop net.

**Figure 6.** Self-Loop.

#### **2.3. Elementary structures**

Elementary nets are used as building blocks in the specification of more complex applications. Figure 7 shows five structures, namely, (a) sequence, (b) fork, (c) synchronization, (d) choice, and (e) merging.

**Figure 7.** Elementary PN Structures.

#### **Sequence**

Sequence structure represents sequential execution of actions, provided that a condition is satisfied. After the firing of a transition, another transition is enabled to fire. Figure 7(a) depicts an example of this structure in which a mark in place *p*<sup>0</sup> enables the transition *t*0. The firing of transition *t*<sup>0</sup> enables the transition *t*<sup>1</sup> (*p*<sup>1</sup> is marked).

#### **Fork**

6 Petri Nets

**Definition 2.10. (Pure net)** A Petri net is said to be pure if it has no self-loops. A pair of a place *p* and transition *t* is called a self-loop if *p* is both an input and output place of *t*. Figure

Elementary nets are used as building blocks in the specification of more complex applications. Figure 7 shows five structures, namely, (a) sequence, (b) fork, (c) synchronization, (d) choice,

Sequence structure represents sequential execution of actions, provided that a condition is satisfied. After the firing of a transition, another transition is enabled to fire. Figure 7(a) depicts an example of this structure in which a mark in place *p*<sup>0</sup> enables the transition *t*0. The

**Figure 5.** PN with an inhibitor arc.

6 shows a self-loop net.

**Figure 6.** Self-Loop.

and (e) merging.

**2.3. Elementary structures**

**Figure 7.** Elementary PN Structures.

firing of transition *t*<sup>0</sup> enables the transition *t*<sup>1</sup> (*p*<sup>1</sup> is marked).

**Sequence**

Figure 7(b) shows an example of a fork structure that allows the creation of parallel processes.

#### **Join**

Generally, concurrent activities need to synchronize with each other. This net (Figure 7(c)) combines two or more nets, allowing that another process continues this execution only after the end of predecessor processes.

#### **Choice**

Figure 7(d) depicts a choice model, in which the firing of the transition *t*0 disables the transition *t*1. This building block is suited for modeling if-then-else statement, for instance.

#### **Merging**

The merging is an elementary net that allows the enabling of the same transition by two or more processes. Figure 7(e) shows a net with two independent transitions (*t*<sup>0</sup> and *t*1) that have an output place in common (*P*2). Therefore, firing of any of these two transitions, a condition is created (*p*<sup>2</sup> is marked) which allows the firing of another transition (not shown in the figure).

#### **Confusions**

The mixing between conflict and concurrency is called confusion. While conflict is a local phenomenon in the sense that only the pre-sets of the transitions with common input places are involved, confusion involves firing sequences. Figure 8 depicts two types of confusions: (a) symmetric confusion, where two transitions *t*<sup>1</sup> and *t*<sup>3</sup> are concurrent while each one is in conflict with transition *t*2; and (b) asymmetric confusion, where *t*<sup>1</sup> is concurrent with *t*2, but will be in conflict with *t*<sup>3</sup> if *t*<sup>2</sup> fires first.

**Figure 8.** (a) symmetric confusion; (b) asymmetric confusion.

#### **2.4. Petri nets modeling examples**

In this section, several simple examples are given in order to introduce how to model some basic concepts such as parallel process and mutual exclusion in Petri nets.

#### **Parallel processes**

In order to represent parallel processes, a model may be obtained by composing the model for each individual process with a fork and synchronization models. Two transitions are said to be parallel (or concurrent), if they are causally independent, i.e., one transition may fire either before (or after) or in parallel with the other.

**Dataflow computation**

dataflow computation is completed.

**Figure 11.** Dataflow example.

**2.5. Petri nets properties**

*2.5.1. Behavioral properties*

**Reachability**

on the other hand, are those that are marking-independent.

very important when analyzing a given system.

Petri nets can be used to represent not only the control-flow but also the data-flow. The net shown in Figure 11 is a Petri net representation of a dataflow computation. A dataflow is characterized by the concurrent instruction execution (or transitions firing) as soon as the operands (pre-conditions) are available. In the Petri net representation, tokens may denote values of current data as well as the availability of data. The instructions are represented by transitions such as *Add* and *Subtract* that can be executed in parallel. After that, if the activity *Subtract* has computed a result different from zero, meaning that the pre-conditions to perform *divide* operation were satisfied. Afterwards, when the transition *divide* occur, the

A Petri Net-Based Approach to the Quanti cation of Data Center Dependability 321

The PN properties allow a detailed analysis of the modeled system. For this, two types of properties have been considered in a Petri net model: behavioral and structural properties. Behavioral properties are those which depend on the initial marking. Structural properties,

This section, based on [14], describes some behavioral properties, since such properties are

The firing of an enabled transition changes the token marking in a Petri net, and a sequence of firings results in a sequence of markings. A marking *Mn* is said to be reachable from a

A firing (or occurrence) sequence is denoted by *σ* = *t*1, *t*2, ...,*tn*. In this case, *mi* is reachable from *m*<sup>0</sup> by *σ*, and it is denoted by *m*0[*σ* > *mi*. The set of all possible reachable markings from *m*<sup>0</sup> in a net (PN, *m*0) is denoted by R(PN,*m*0), or simply R(*m*0). The set of all possible firing sequence from *m*<sup>0</sup> in a net (PN,*m*0) is denoted by L(PN, *m*0), or simply L(*m*0).

marking *M*<sup>0</sup> if there exists a sequence of firings that transforms *M*<sup>0</sup> to *Mn*.

Figure 9 depicts an example of parallel process, where transitions *t*<sup>1</sup> and *t*<sup>2</sup> represent parallel activities. When transition *t*<sup>0</sup> fires, it creates marks in both output places (*p*<sup>0</sup> and *p*1), representing a concurrency. When *t*<sup>1</sup> and *t*<sup>2</sup> are enabled for firing, each one may fire independently. The firing of *t*<sup>3</sup> depends on two pre-conditions, *p*<sup>2</sup> and *p*3, implying that the system only continues if *t*<sup>1</sup> and *t*<sup>2</sup> have been fired.

Figure 9 presents a net in which each place has exactly one incoming arc and exactly one outgoing arc. Thus, such model represents a sub-class of Petri nets known as marked graphs. Marked graphs allow representation of concurrency but not decisions or conflicts.

**Figure 9.** A Petri net representing parallel activities.

#### **Mutual exclusion**

The sharing of resources and/or data are common in many system applications, in which most of resources and data should be accessed in a mutual exclusive way. Resources (or data variable) may be modeled by a place with tokens representing the amount of resources. This place is seen as pre-conditions for all transitions that need such resource. After the use of one resource, it must be released. Figure 10 depicts an example of a machine that is accessed in a mutual exclusive way.

**Figure 10.** Mutual Exclusion.

#### **Dataflow computation**

8 Petri Nets

In order to represent parallel processes, a model may be obtained by composing the model for each individual process with a fork and synchronization models. Two transitions are said to be parallel (or concurrent), if they are causally independent, i.e., one transition may fire either

Figure 9 depicts an example of parallel process, where transitions *t*<sup>1</sup> and *t*<sup>2</sup> represent parallel activities. When transition *t*<sup>0</sup> fires, it creates marks in both output places (*p*<sup>0</sup> and *p*1), representing a concurrency. When *t*<sup>1</sup> and *t*<sup>2</sup> are enabled for firing, each one may fire independently. The firing of *t*<sup>3</sup> depends on two pre-conditions, *p*<sup>2</sup> and *p*3, implying that the

Figure 9 presents a net in which each place has exactly one incoming arc and exactly one outgoing arc. Thus, such model represents a sub-class of Petri nets known as marked graphs.

The sharing of resources and/or data are common in many system applications, in which most of resources and data should be accessed in a mutual exclusive way. Resources (or data variable) may be modeled by a place with tokens representing the amount of resources. This place is seen as pre-conditions for all transitions that need such resource. After the use of one resource, it must be released. Figure 10 depicts an example of a machine that is accessed in a

Marked graphs allow representation of concurrency but not decisions or conflicts.

**Parallel processes**

before (or after) or in parallel with the other.

system only continues if *t*<sup>1</sup> and *t*<sup>2</sup> have been fired.

**Figure 9.** A Petri net representing parallel activities.

**Mutual exclusion**

mutual exclusive way.

**Figure 10.** Mutual Exclusion.

Petri nets can be used to represent not only the control-flow but also the data-flow. The net shown in Figure 11 is a Petri net representation of a dataflow computation. A dataflow is characterized by the concurrent instruction execution (or transitions firing) as soon as the operands (pre-conditions) are available. In the Petri net representation, tokens may denote values of current data as well as the availability of data. The instructions are represented by transitions such as *Add* and *Subtract* that can be executed in parallel. After that, if the activity *Subtract* has computed a result different from zero, meaning that the pre-conditions to perform *divide* operation were satisfied. Afterwards, when the transition *divide* occur, the dataflow computation is completed.

**Figure 11.** Dataflow example.
