Concepts of Concurrent Computation Spring 2015 Lecture 9: Petri Nets

Similar documents
Finite Automata. Informatics 2A: Lecture 3. John Longley. 22 September School of Informatics University of Edinburgh

Intermediate Math Circles Wednesday, November 14, 2018 Finite Automata II. Nickolas Rollick a b b. a b 4

Semantic reachability for simple process algebras. Richard Mayr. Abstract

Properties of Integrals, Indefinite Integrals. Goals: Definition of the Definite Integral Integral Calculations using Antiderivatives

Semantic Reachability. Richard Mayr. Institut fur Informatik. Technische Universitat Munchen. Arcisstr. 21, D Munchen, Germany E. N. T. C. S.

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018

Finite Automata. Informatics 2A: Lecture 3. Mary Cryan. 21 September School of Informatics University of Edinburgh

Lecture 9: LTL and Büchi Automata

Nondeterminism and Nodeterministic Automata

CS:4330 Theory of Computation Spring Regular Languages. Equivalences between Finite automata and REs. Haniel Barbosa

New Expansion and Infinite Series

Bisimulation. R.J. van Glabbeek

CS 188: Artificial Intelligence Spring 2007

Infinite Geometric Series

Probabilistic Model Checking Michaelmas Term Dr. Dave Parker. Department of Computer Science University of Oxford

CS103B Handout 18 Winter 2007 February 28, 2007 Finite Automata

Strong Bisimulation. Overview. References. Actions Labeled transition system Transition semantics Simulation Bisimulation

Chapter 2 Finite Automata

Convert the NFA into DFA

CS 275 Automata and Formal Language Theory

1 Online Learning and Regret Minimization

Chapter Five: Nondeterministic Finite Automata. Formal Language, chapter 5, slide 1

CMPSCI 250: Introduction to Computation. Lecture #31: What DFA s Can and Can t Do David Mix Barrington 9 April 2014

1. For each of the following theorems, give a two or three sentence sketch of how the proof goes or why it is not true.

Administrivia CSE 190: Reinforcement Learning: An Introduction

Deterministic Finite Automata

378 Relations Solutions for Chapter 16. Section 16.1 Exercises. 3. Let A = {0,1,2,3,4,5}. Write out the relation R that expresses on A.

Review of Gaussian Quadrature method

CS 275 Automata and Formal Language Theory

NFAs and Regular Expressions. NFA-ε, continued. Recall. Last class: Today: Fun:

Arithmetic & Algebra. NCTM National Conference, 2017

AUTOMATA AND LANGUAGES. Definition 1.5: Finite Automaton

Recitation 3: More Applications of the Derivative

DATA Search I 魏忠钰. 复旦大学大数据学院 School of Data Science, Fudan University. March 7 th, 2018

Math Lecture 23

CS 188 Introduction to Artificial Intelligence Fall 2018 Note 7

Chapter 1, Part 1. Regular Languages. CSC527, Chapter 1, Part 1 c 2012 Mitsunori Ogihara 1

1 Nondeterministic Finite Automata

Goals: Determine how to calculate the area described by a function. Define the definite integral. Explore the relationship between the definite

Exponentials - Grade 10 [CAPS] *

Math 1B, lecture 4: Error bounds for numerical methods

Handout: Natural deduction for first order logic

MAA 4212 Improper Integrals

COMPUTING SCIENCE. University of Newcastle upon Tyne. A Note on the Well-Foundedness of Adequate Orders Used for Truncating Unfoldings

Review of Calculus, cont d

How to simulate Turing machines by invertible one-dimensional cellular automata

Minimal DFA. minimal DFA for L starting from any other

Lecture 3: Equivalence Relations

CS5371 Theory of Computation. Lecture 20: Complexity V (Polynomial-Time Reducibility)

Kleene Theorems for Free Choice Nets Labelled with Distributed Alphabets

Uninformed Search Lecture 4

Summer School Verification Technology, Systems & Applications

Formal Languages and Automata

Process Algebra CSP A Technique to Model Concurrent Programs

Jim Lambers MAT 169 Fall Semester Lecture 4 Notes

More on automata. Michael George. March 24 April 7, 2014

CS 267: Automated Verification. Lecture 8: Automata Theoretic Model Checking. Instructor: Tevfik Bultan

FABER Formal Languages, Automata and Models of Computation

3 Regular expressions

Non-deterministic Finite Automata

Part 5 out of 5. Automata & languages. A primer on the Theory of Computation. Last week was all about. a superset of Regular Languages

STRUCTURE OF CONCURRENCY Ryszard Janicki. Department of Computing and Software McMaster University Hamilton, ON, L8S 4K1 Canada

Anatomy of a Deterministic Finite Automaton. Deterministic Finite Automata. A machine so simple that you can understand it in less than one minute

Classical Mechanics. From Molecular to Con/nuum Physics I WS 11/12 Emiliano Ippoli/ October, 2011

Finite Automata Part Three

Chapter 8.2: The Integral

The Wave Equation I. MA 436 Kurt Bryan

Interpreting Integrals and the Fundamental Theorem

Equations and Inequalities

Main topics for the First Midterm

A Polynomial-Time Algorithm for Checking Consistency of Free-Choice Signal Transition Graphs

Conservation Law. Chapter Goal. 5.2 Theory

Chapter 0. What is the Lebesgue integral about?

Coalgebra, Lecture 15: Equations for Deterministic Automata

CSCI 340: Computational Models. Kleene s Theorem. Department of Computer Science

Week 10: Line Integrals

Numerical Integration

Petri Nets and Regular Processes

The practical version

Unit #9 : Definite Integral Properties; Fundamental Theorem of Calculus

CS 373, Spring Solutions to Mock midterm 1 (Based on first midterm in CS 273, Fall 2008.)

Final Exam - Review MATH Spring 2017

Decision Networks. CS 188: Artificial Intelligence Fall Example: Decision Networks. Decision Networks. Decisions as Outcome Trees

BIFURCATIONS IN ONE-DIMENSIONAL DISCRETE SYSTEMS

Software Engineering using Formal Methods

MTH 122 Fall 2008 Essex County College Division of Mathematics Handout Version 10 1 October 14, 2008

Lecture 3. Limits of Functions and Continuity

Lexical Analysis Finite Automate

Where did dynamic programming come from?

Resources. Introduction: Binding. Resource Types. Resource Sharing. The type of a resource denotes its ability to perform different operations

CISC 4090 Theory of Computation

CS 314 Principles of Programming Languages

Non-Deterministic Finite Automata. Fall 2018 Costas Busch - RPI 1

Learning Moore Machines from Input-Output Traces

19 Optimal behavior: Game theory

1 PYTHAGORAS THEOREM 1. Given a right angled triangle, the square of the hypotenuse is equal to the sum of the squares of the other two sides.

Chapter 6. Infinite series

I1 = I2 I1 = I2 + I3 I1 + I2 = I3 + I4 I 3

Lecture 3. In this lecture, we will discuss algorithms for solving systems of linear equations.

CMDA 4604: Intermediate Topics in Mathematical Modeling Lecture 19: Interpolation and Quadrature

Transcription:

Concepts of Concurrent Computtion Spring 205 Lecture 9: Petri Nets Sebstin Nnz Chris Poskitt Chir of Softwre Engineering

Petri nets Petri nets re mthemticl models for describing systems with concurrency nd resource shring they fcilitte mny utomtic nlyses of interest for concurrent systems rich, intuitive grphicl nottion for choice, concurrent execution, interction with the environment,... 2

Petri nets - the origins proposed by Crl Adm Petri in his fmous thesis Kommuniktion mit Automten (962) imed for system rchitecture tht could be expnded indefinitely => no centrl components => in prticulr, no centrl, synchronising clock => ctions with loclly confined cuses/effects originl presenttion omitted the grphicl representtion 3

Tody s gend. modelling concepts: cookies for everyone! 2. synchronistion problems s Petri nets 3. Petri net nlyses 4. true concurrency semntics; unfoldings 4

Let s design cookie vending mchine coin slot comprtment 5

Let s design cookie vending mchine coin slot comprtment 6

Let s design cookie vending mchine t coin slot comprtment 7

Let s design cookie vending mchine t coin slot comprtment 8

Terminology plce tokens t trnsition (with precondition ) t mrking (distribution of tokens) 9

Let s design cookie vending mchine t coin slot comprtment 0

Let s design cookie vending mchine t coin slot comprtment trnsition t is enbled it cn occur nd chnge the mrking

Let s design cookie vending mchine t coin slot comprtment trnsition t is enbled it cn occur nd chnge the mrking 2

Let s design cookie vending mchine t coin slot comprtment trnsition t is enbled it cn occur nd chnge the mrking! csh box? finitely mny cookies?

Let s look inside storge b coin slot signl comprtment csh box 4

Let s look inside storge b coin slot signl comprtment csh box 5

Let s look inside storge b coin slot signl comprtment csh box 6

Let s look inside storge b coin slot signl comprtment csh box 7

Let s open it up to the world 8

Let s open it up to the world storge ϵ insert coin slot signl b comprtment ϵ tke csh box 9

Let s open it up to the world storge ϵ insert coin slot signl b comprtment ϵ tke csh box ϵ denotes trnsition tht once enbled, need not ctully occur we ssume tht other enbled trnsitions occur eventully 20

The ultimte cookie mchine storge coin slot ϵ insert signl b comprtment ϵ tke return coin counter csh box 2

The ultimte cookie mchine storge coin slot ϵ insert signl b comprtment ϵ tke return coin counter csh box 22

The ultimte cookie mchine storge coin slot ϵ insert signl b comprtment ϵ tke return coin counter csh box 23

The ultimte cookie mchine storge coin slot ϵ insert signl b comprtment ϵ tke return coin counter csh box! conflict! nondeterminism! 24

The ultimte cookie mchine storge coin slot ϵ insert signl b comprtment ϵ tke return coin counter csh box 25

The ultimte cookie mchine storge coin slot ϵ insert signl b comprtment ϵ tke return coin counter csh box 26

The ultimte cookie mchine storge coin slot ϵ insert signl b comprtment ϵ tke return coin counter exercise: strengthen the design such tht the coin slot nd signl plces csh box store t most one token ech 27

Elementry Petri nets if we re interested in only control flow, we cn use specil cse - elementry Petri nets - where ll tokens re simply blck dots ssume ll edges to be lbelled by: henceforth, we ssume ll Petri nets to be elementry 28

Elementry cookie vending mchine coin slot storge ϵ insert signl b comprtment ϵ tke return coin counter csh box 29

Petri nets: definition n (elementry) Petri net consists of net structure: N = (P, T, F) with finite sets P nd T of plces nd trnsitions, F n edge reltion F (P x T) (T x P) nd n initil mrking M0: P -> N mrkings hve the form M: P -> N; ech plce p holds M(p) tokens 30

Petri nets: definition the preset of trnsition t is the set of plces p connected by edges from p to t (postset defined nlogously) trnsition is enbled if M(p) for ll plces p in the preset n enbled trnsition cn occur, removing token from ech plce in the preset nd dding one to ech plce in the postset 3

Next on the gend. modelling concepts: cookies for everyone! 2. synchronistion problems s Petri nets 3. Petri net nlyses 4. true concurrency semntics; unfoldings 32

Producer-consumer problem store (buffer, int) consume (buffer) Producers 243 46 7 97 Buffer Consumers 33

Producer-consumer problem wit consume produce wit 34

Producer-consumer problem wit consume buffer spce buffer count produce wit 35

Producer-consumer problem wit consume buffer spce buffer count produce wit 36

Producer-consumer problem wit consume buffer spce buffer count produce wit 37

Producer-consumer problem wit consume buffer spce buffer count produce wit 38

Producer-consumer problem wit consume buffer spce buffer count produce wit 39

Producer-consumer problem wit consume buffer spce buffer count produce wit 40

Mutul exclusion witing witing2 ϵ CR CR2 ϵ locl locl2 4

Mutul exclusion witing witing2 semphore ϵ CR CR2 ϵ locl locl2 42

Next on the gend. modelling concepts: cookies for everyone! 2. synchronistion problems s Petri nets 3. Petri net nlyses 4. true concurrency semntics; unfoldings 43

Modelling power vs. nlysbility mny properties of interest for concurrent systems cn be utomticlly determined for Petri nets => but cn be very expensive in the generl cse properties include: => k-boundedness (i.e. no plce ever hs more thn k tokens) => liveness => rechbility severl tools re vilble => http://www.informtik.uni-hmburg.de/tgi/petrinets/tools/quick.html 44

Rechbility problem the problem to decide whether some mrking M cn be derived from the initil mrking strting point: construct rechbility grph from the initil mrking => i.e. trnsition system completely describing its behviour => nodes denote mrkings => edges denote occurrences (more sophistiction is needed when rechbility grphs re not finite) 45

Rechbility grph for our semphore wit wit2 sem ϵ CR CR2 ϵ loc loc2 express mrking M s vector: ( M(wit) M(CR) M(loc) M(sem) M(wit2) M(CR2) M(loc2) ) i.e. ( 0 0 0 0 )

Rechbility grph for our semphore wit wit2 sem ϵ CR CR2 ϵ loc loc2 prove tht (0 0 0 0 0) is unrechble prove tht M(CR)+M(CR2)+M(sem) =

Rechbility grph for our semphore ( 0 0 0 0 ) ( 0 0 0 0 0 ) ( 0 0 0 0 0 ) ( 0 0 0 0 ) ( 0 0 0 0 ) ( 0 0 0 0 0 ) ( 0 0 0 0 0 ) ( 0 0 0 0 ) 48

Deciding rechbility is expensive rechbility is n importnt nlysis decidble, but expensive in the generl cse => EXPSPACE-hrd => rechbility grph not lwys finite prt II of Reisig (203) trets the problem with more sophistiction thn we hve 49

Next on the gend. modelling concepts: cookies for everyone! 2. synchronistion problems s Petri nets 3. Petri net nlyses 4. true concurrency semntics; unfoldings 50

The problem of interleving semntics consider the following Petri net:... n its rechbility grph contins 2 n sttes => stte explosion problem => due to interleving of occurrences => unnecessry: ordering of occurrences here immteril! 5

Interleving vs. true concurrency semntics n interleving semntics imposes totl ordering on sequences of occurrences => completely described by rechbility grph => nodes denote mrkings; edges denote occurrences => stte explosion! true concurrency semntics insted models time s prtil order => two or more occurrences cn hppen simultneously => completely described by so-clled unfolding 52

Unfoldings re more compct representtions of concurrency n unfolding of Petri net N is Petri net tht is more tree like - but represents the sme behviour explicitly represents concurrency nd cusl dependence between different behviours ide: nlyse the unfolding of Petri net itself, rther thn n underlying trnsition system (s in the interleving semntics) 53

A Exmple: n unfolding C B D 54

A Exmple: n unfolding C B D A C 55

A Exmple: n unfolding C B D A B C 56

A Exmple: n unfolding C B D A B A C 57

A Exmple: n unfolding C B D A B A B C 58

A Exmple: n unfolding C B D A B A B D C 59

A Exmple: n unfolding C B D A B A B A C D 60

A Exmple: n unfolding C B D A B A B A... D D C... 6

Constructing n unfolding ssumption: Petri nets re -bounded => possible to generlise to other Petri net vrints steps to construct n unfolding N from Petri net N: () initilise N with the plces in N contining tokens in the initil mrking (2) if rechble* mrking in N enbles trnsition t in N, then disjointly dd t to N nd: => link it to the corresponding preset => disjointly dd the postset of t (3) iterte step 2 *checking rechbility is fr esier for the unfolding net clss 62

A B C Another exmple A2 B2 C2 63

A B C Another exmple A2 B2 C2 A B C 64

A B C Another exmple A2 B2 C2 A B C C2 65

A B C Another exmple A2 B2 C2 A B B2 C C2 C 66

A B C Another exmple A2 B2 C2 A A2 B B2 B C C2 C 67

A B C Another exmple A2 B2 C2 A A2 B B2 B C C2 C C2 68

A B C Another exmple A2 B2 C2 A A2 A B B2 B C C2 C C2 69

A B C Another exmple A2 B2 C2... A A2 A B B2 B B2... C C2 C C2 C... 70

Returning to our smll exmple construct n unfolding of the following Petri net:... n 7

Returning to our smll exmple construct n unfolding of the following Petri net:... n the unfolding is just the Petri net itself! => size O(n) => wheres interleving yields 2 n rechble sttes 72

Petri net nlysis using unfoldings suppose we wnt to know if some trnsition t in Petri net N cn occur compute n nswer by exploring the unfolding of N until either: => trnsition lbelled t is found => or it cn be concluded tht no such trnsition occurs for finite unfoldings, compute nd explore the whole structure for infinite unfoldings, only finite prefix is computed nd explored 73

A B b c A2 d B2 e f A3 B3 x A4 cn x ever occur?

A B A B b c A2 d B2 e f A3 B3 x A4 cn x ever occur?

A B b c A2 A b B B2 A2 B2 d e f A3 B3 x A4 cn x ever occur?

A B b c A2 A b B B2 A2 d B2 e f c d A3 B3 x A B A3 A4 cn x ever occur?

A B b c A2 A b B B2 A2 d B2 e f c d A3 B3 x A B A3 A4 b cn x ever occur? A2 B2

A B b c A2 A b B B2 A2 d B2 e f c d A3 B3 x A B A3 A4 b e cn x ever occur? A2 B2 A2 B3

A B b c A2 A b B B2 A2 d B2 e f c d A3 B3 x A B A3 A4 b e cn x ever occur? A2 B2 A2 B3 d A A3

A B b c A2 A b B B2 A2 d B2 e f c d A3 B3 x A B A3 A4 b e cn x ever occur? A2 B2 A2 B3... d f A A3 B2......

A B b c A2 A b B B2 A2 d B2 e f c d A3 B3 x A B A3 A4 b e cn x ever occur? A2 B2 A2 B3 d f need we compute further? A A3 B2

Complete finite prefix complete finite prefix is finite prt of n unfolding tht is sufficient for deciding certin questions bout the originl Petri net => e.g. executbility, repeted executbility, livelock,... chllenge is to determine when to stop unfolding without informtion loss => outside scope of this lecture; see Esprz & Heljnko (2008) previous slide gve complete finite prefix => no x in the prefix; hence x cn never occur in the originl Petri net complete finite prefixes cn be exponentilly more concise thn n interleving-bsed representtion

Next on the gend. modelling concepts: cookies for everyone! 2. synchronistion problems s Petri nets 3. Petri net nlyses 4. true concurrency semntics; unfoldings 84

Min sources for this lecture Understnding Petri Nets (203) => by Wolfgng Reisig => chpters -3 Unfoldings (2008) => by Jvier Esprz & Keijo Heljnko => chpters -3 A Flse History of True Concurrency => http://dx.doi.org/0.007/978-3-642-664-3_3 => https://www7.in.tum.de/~esprz/tlks/lmpstrueconc.pdf 85

Summry Petri nets fcilitte grphicl, intuitive mens of modelling concurrent nd distributed systems utomtic nlyses exist for rechbility, boundedness, liveness,... but re expensive in the generl cse unfoldings (bsed on true concurrency) my give more compct representtion of concurrency thn rechbility grphs (bsed on interlevings) 86