Petri Nets(PDF)
Total Page:16
File Type:pdf, Size:1020Kb
Petri Nets* JAMES L. PETERSON Department of Computer Sciences, The Unwers~ty of Texas, Austin, Texas 78712 Over the last decade, the Petri net has gamed increased usage and acceptance as a basic model of systems of asynchronous concurrent computation. This paper surveys the basic concepts and uses of Petm nets. The structure of Petri nets, their markings and execution, several examples of Petm net models of computer hardware and software, and research into the analysis of Petm nets are presented, as are the use of the reachability tree and the decidability and complexity of some Petri net problems. Petri net languages, models of computation related to Petm nets, and some extensions and subclasses of the Petri net model are also bmefly discussed Keywords and Phrases: Petn nets, system models, asynchronous concurrent events. CR Categories. 1.3, 5.29, 8.1 INTRODUCTION tems of parallel or concurrent activities. Section 3 presents a more formal definition A Petri net is an abstract, formal model of and discussion of the fundamental con- information flow. The properties, con- cepts and notations of Petri nets. Section 4 cepts, and techniques of Petri nets are considers the extensive body of research being developed in a search for natural, dealing with the analysis of Petri nets, simple, and powerful methods for describ- their advantages, and their limitations. ing and analyzing the flow of information Petri net languages are presented in Sec- and control in systems, particularly sys- tion 5. Finally, in Section 6, we consider tems that may exhibit asynchronous and some of the many variations of Petri nets concurrent activities. The major use of Pe- that have been defined, both as generali- tri nets has been the modeling of systems zations of Petri nets and as subclasses of of events in which it is possible for some the general model; the more general events to occur concurrently but there are models have certain advantages for model- constraints on the concurrence, prece- ing, while the more restricted models have dence, or frequency of these occurrences. certain advantages for analysis. Since many readers may be unfamiliar with Petri nets, we first present a very 1. OVERVIEW brief and informal introduction to their Figure 1 shows a simple Petri net. The fundamentals and history. Then we con- pictorial representation of a Petri net as a sider several aspects of Petri nets in more graph used in this illustration is common detail. We begin, in Section 2, by consider- practice in Petri net research. The Petri ing the use of Petri nets for modeling sys- net graph models the static properties of a system, much as a flowchart represents * This work was supported, m part, by the National Science Foundation, under Grant Number MCS75- the static properties of a computer pro- 16425. gram. Copyright © 1977, Association for Computing Machinery, Inc. General permismon to republish, but not for profit, all or part of this material is granted provided that ACM's copyright notice is given and that reference is made to the publication, to its date of msue, and to the fact that reprinting privileges were granted by permission of the Associat]on for Computing Machinery. Computing Surveys, Vol 9, No. 3, September 1977 224 * J. L. Peterson CONTENTS the Petri net. Tokens, indicated by black dots, reside in the circles representing the places of the net. A Petri net with tokens is INTRODUCTION a marked Petri net. 1 OVERVIEW The use of the tokens rather resembles a Hmtory 2. MODELING WITH PETRI NETS board game. These are the rules: Tokens Properties of Petn Nets Useful m Modeling are moved by the firing of the transitions Modeling of Hardware of the net. A transition must be enabled in Modehng of Software 3 STRUCTURE OF PETRI NETS order to fire. (A transition is enabled when The Petn Net Graph all of its input places have a token in Markings them.) The transition fires by removing Executmn Rules for Marked Petrl Nets The State Space of a Petn Net the enabling tokens from their input The Reachabfllty Set of a Petrl Net places and generating new tokens which 4 ANALYSIS OF PETRI NETS Analysis Questmns are deposited in the output places of the Solutmn Techmques transition. In the marked Petri net of Fig. Analysis Using the Reachabfllty Tree 2, for example, the transition t2 is enabled The Reachablhty Problem Unsolvable Problems since it has a token in its input place (Pl)" Complexity Transition ts, on the other hand, is not 5 PETRI NET LANGUAGES enabled since one of its inputs (P3) does not 6 EXTENSIONS AND SUBCLASSES Extended Petrt Nets have a token. If t2 fires, the marked Petri Subclasses of Petrl Nets net of Fig. 3 results. The firing of transi- Related Models tion t2 removes the enabling token from CONCLUSIONS ACKNOWLEDGMENTS place Pl and puts tokens in p2 and P3, the BIBLIOGRAPHY two outputs of t2. The distribution of tokens in a marked Petri net defines the state of the net and is v called its marking. The marking may change as a result of the firing of transi- tions. In different markings, different The graph contains two types of nodes: transitions may be enabled. For example, circles (called places) and bars (called in the marked net of Fig. 3 three transi- transitions). These nodes, places and tran- tions are enabled: tl, t3, and t5, none of sitions, are connected by directed arcs which were enabled in the marking of Fig. from places to transitions and from transi- tions to places. If an arc is directed from node i to node j (either from a place to a transition or a transition to a place), then i is an input to j, andj is an output of i. In Fig. 1, for example, placepl is an input to transition t2, while places P2 and p3 are outputs of transition t2. In addition to the static properties repre- sented by the graph, a Petri net has dy- namic properties that result from its exe- cution. Assume that the execution of a computer program represented by a flow- chart is exhibited by placing a marker on the flowchart to mark the instruction being executed, and that as the execution progresses, the marker moves around the flowchart. Similarly, the execution of a Petri net is controlled by the position and FIGURE 1. A simple graph representation ofa Petrl movement of markers (called tokens) in net. Computing Surveys, Vol. 9, No 3, September 1977 Petri Nets • 225 Pl sition t5 has been disabled since there is no longer a token in place P3. In the marking of Fig. 4c, transition t3 has become disa- bled. Firing either of transitions t3 or t5 disables the other; they are said to be in conflict. This simple, vague, and incomplete ex- ample of a Petri net is meant to give a brief introduction to the basic concepts of Petri nets. It also raises some questions for fur- 5~ p5p ther consideration. For example, the markings of Figs. 3, 4a, 4b, and4c were generated from the marking of Fig. 2 by 7 firing transitions. Can we characterize the class of markings that may be reached from a given marked Petri net? Can we characterize the class of sequences of tran- FIGURE 2. A marked Petr~ net. sition firings that are possible from a marked Petri net? What interesting prop- erties can Petri nets have and how can these properties be tested for? Some of these questions are of interest for Petri nets as abstract formal entities. t Other questions relate to Petri nets in their function as models of other systems, existing or proposed. For example, the net of Fig. 2 can represent a producer-con- sumer problem [25] with one producer (places p~ and P2) and two consumers (places P4, P5 and pe, P7). The items pro- duced by the producer are passed to the consumers. This is modeled by placep3 and P7 the tokens '~roduced" by transition t 2 and t~ "consumed" by transitions t3 and ts. For this interpretation of the net, we may be interested in how far the producer can get FIGURE 3 The marking resulting from firing tran- ahead of the consumers (the maximum sition t2 in Fig. 2 Note that the token in Pl was number of tokens in P3), whether the con- removed and tokens were added to p2 and p3- sumers could get ahead of the producer or consume the same item twice, and so on. 2. In this situation, we have a choice as to The use of Petri nets in modeling is dis- which transition will fire next. Figure 4 cussed in Section 2. shows the three possible resultant mark- Although Petri nets are basically very ings; from each of these, other markings simple, they may be approached and uti- may then be reached since transition fir- lized in a large number of ways. Petri nets ings may continue as long as there is an can be considered as formal automata and enabled transition. investigated either as automata or as gen- Note that in the marking of Fig. 4a, erators of formal languages [37, 79]. Ques- transitions t3 and t5 remain enabled, and tions dealing with the theory of computa- transition t2 is also enabled; if transition t2 tional complexity have been raised [64, fires, the resulting marking will have two 49]. Petri nets have associations with the tokens in place p3. In the marking of Fig. study of linear algebra [69], Presburger 4b, transition t~ remains enabled but tran- arithmetic [52], and graph theory. They Computing Surveys, Vol.