Petri Nets. Petri Nets. Petri Net Example. Systems are specified as a directed bipartite graph. The two kinds of nodes in the graph:

Similar documents
Hardware-Software Codesign. 6. System Simulation

EE249 Discussion Petri Nets: Properties, Analysis and Applications - T. Murata. Chang-Ching Wu 10/9/2007

Introduction to Electronic Design Automation. Model of Computation. Model of Computation. Model of Computation

By: Chaitanya Settaluri Devendra Kalia

System Design and Methodology/ Embedded Systems Design (Modeling and Design of Embedded Systems)

Petri Nets ee249 Fall 2000

Discrete Event Models

Parallel Discrete Event Simulation

Inst: Chris Davison

Specifications and Modeling

Modeling Hybrid Systems with Petri Nets

Petri Nets. Robert A. McGuigan, Department of Mathematics, Westfield State

Petri Nets ~------~ R-ES-O---N-A-N-C-E-I--se-p-te-m--be-r Applications.

Timed Circuit Verification Using TEL Structures

Formal Methods in Software Engineering. Lecture 07

Computational Models for Concurrent Streaming Applications

EECS 144/244: Fundamental Algorithms for System Modeling, Analysis, and Optimization

Supply Tank 1. Storage Tank 1 TE1. Supply Tank 2. Storage Tank 2 TE2

fakultät für informatik informatik 12 technische universität dortmund Data flow models Peter Marwedel TU Dortmund, Informatik /10/08

SDL. Jian-Jia Chen (slides are based on Peter Marwedel) TU Dortmund, Informatik 年 10 月 18 日. technische universität dortmund

CS4514 Real-Time Systems and Modeling

Embedded Systems 7. Models of computation for embedded systems

Unit 2: High-Level Synthesis

Interaction Testing! Chapter 15!!

Embedded Systems CS - ES

Discrete Event Models

EE382N.23: Embedded System Design and Modeling

Editor. Analyser XML. Scheduler. generator. Code Generator Code. Scheduler. Analyser. Simulator. Controller Synthesizer.

Colored Petri Net Evaluation Tool. Stephen Rojcewicz CS 2310

Coverability Graph and Fairness

Consensus a classic problem. Consensus, impossibility results and Paxos. Distributed Consensus. Asynchronous networks.

FSMs & message passing: SDL

Formal Support for QVT-Relations with Coloured Petri Nets

Embedded Systems 7 BF - ES - 1 -

Tokens vs. Signals: On Conformance between Formal Models of Dataflow and Hardware

Outline. Petri nets. Introduction Examples Properties Analysis techniques. 1 EE249Fall04

Modeling Routing Constructs to Represent Distributed Workflow Processes Using Extended Petri Nets

The UPPAAL Model Checker. Julián Proenza Systems, Robotics and Vision Group. UIB. SPAIN

2. Introduction to Software for Embedded Systems

Stochastic Petri nets

Promela and SPIN. Mads Dam Dept. Microelectronics and Information Technology Royal Institute of Technology, KTH. Promela and SPIN

Model checking pushdown systems

Consensus, impossibility results and Paxos. Ken Birman

Synthesis of Systems Specified as Interacting VHDL Processes

From synchronous models to distributed, asynchronous architectures

Overview of Dataflow Languages. Waheed Ahmad

Interaction Testing. Chapter 15

TIMES A Tool for Modelling and Implementation of Embedded Systems

Hierarchical FSMs with Multiple CMs

AMAJOR impediment to further progress in modeling

CA441 BPM - Modelling Workflow with Petri Nets. Modelling Workflow with Petri Nets. Workflow Management Issues. Workflow. Process.

Coloured Petri Nets Modelling and Validation of Concurrent Systems. Chapter 1: Modelling and Validation

Modeling and Simulating Discrete Event Systems in Metropolis

WEEK 5 - APPLICATION OF PETRI NETS. 4.4 Producers-consumers problem with priority

Modular Petri Net Processor for Embedded Systems

HYBRID PETRI NET MODEL BASED DECISION SUPPORT SYSTEM. Janetta Culita, Simona Caramihai, Calin Munteanu

Technische Universiteit Eindhoven Department of Mathematics and Computer Science. Relationship between Simulink and Petri nets

Lecture 6. Abstract Interpretation

Formal modelling and verification in UPPAAL

14.1 Encoding for different models of computation

RTL Implementation. Introduction to Structured VLSI Design. Concurrent Statements and Processes. Combinational and Sequential Logic.

Introduction to Modeling. Lecture Overview

Ravi K. Gedela, Sol M. Shatz and Haiping Xu Concurrent Software Systems Lab The University of Illinois at Chicago Chicago, IL USA

Specifications and Modeling

Process Modelling using Petri Nets

CONSIDERATIONS CONCERNING PARALLEL AND DISTRIBUTED ARCHITECTURE FOR INTELLIGENT SYSTEMS

Introduction to MARIA and High-Level Petri Nets

Portland State University ECE 588/688. Dataflow Architectures

Winford Engineering ETH32 Protocol Reference

Spiking Neural P Systems and Petri Nets

Concurrent Systems Modeling using Petri Nets Part II

Technical Research on Describing Reconfigurable Systems by Object Oriented Petri net

Petri-net-based Workflow Management Software

Automatic synthesis of switching controllers for linear hybrid systems: Reachability control

Hierarchical Petri Net Simulator: Simulation, Design Validation, and Model Checking Tool for Hierarchical Place/Transition Petri Nets

Computer-System Architecture (cont.) Symmetrically Constructed Clusters (cont.) Advantages: 1. Greater computational power by running applications

Hardware Description Languages & System Description Languages Properties

Fundamental Algorithms for System Modeling, Analysis, and Optimization

From Task Graphs to Petri Nets

! Use of formal notations. ! in software system descriptions. ! for a broad range of effects. ! and varying levels of use. !

PETRI NET ANALYSIS OF BATCH RECIPES

5. VHDL - Introduction - 5. VHDL - Design flow - 5. VHDL - Entities and Architectures (1) - 5. VHDL - Entities and Architectures (2) -

Efficient Synthesis of Production Schedules by Optimization of Timed Automata

Lecture 4: Synchronous Data Flow Graphs - HJ94 goal: Skiing down a mountain

Dynamic Dataflow. Seminar on embedded systems

Coordination 1. To do. Mutual exclusion Election algorithms Next time: Global state. q q q

Overview Computer Networking What is QoS? Queuing discipline and scheduling. Traffic Enforcement. Integrated services

Static Safety Analysis of UML Action Semantics for Critical Systems Development

Using Petri Nets To Test Concurrent Behavior Of Web Applications

VHDL framework for modeling fuzzy automata

Hardware Description Languages & System Description Languages Properties

Part 6: VHDL simulation. Introduction to Modeling and Verification of Digital Systems. Elaboration and simulation. Elaboration and simulation

System Correctness. EEC 421/521: Software Engineering. System Correctness. The Problem at Hand. A system is correct when it meets its requirements

Subsystem Hazard Analysis (SSHA)

A counter-example to the minimal coverability tree algorithm

Programming with MPI

Modeling and Analysis of Fischer s Algorithm

Deterministic Concurrency

MANUFACTURING SYSTEM MODELING USING PETRI NETS

CSE 5306 Distributed Systems. Synchronization

Transcription:

System Design&Methodologies Fö - 1 System Design&Methodologies Fö - 2 Petri Nets 1. Basic Petri Net Model 2. Properties and Analysis of Petri Nets 3. Extended Petri Net Models Petri Nets Systems are specified as a directed bipartite graph. The two kinds of nodes in the graph: 1. Places: they hold the distributed state of the system expressed by the presence/absence of tokens in the places. 2. Transitions: denote the activity in the system The state of the system: captured by the marking of the places (number of tokens in each place) System Design&Methodologies Fö - 3 System Design&Methodologies Fö - 4 Petri Nets (cont d) Petri Net Example A producer and a consumer process communicating through a buffer: The dynamic evolution of the system: determined by the firing process of transitions. A transition may fire whenever all its predecessor places are marked. If a transition fires it removes a token from each predecessor place and adds a token to each successor place.

System Design&Methodologies Fö - System Design&Methodologies Fö - 6 Petri Net Example (cont d) Continuation from previous slide: Petri Net Example (cont d) Continuation from previous slide: Notice that the buffer is considered to be infinite (tokens can accumulate in place B). System Design&Methodologies Fö - 7 System Design&Methodologies Fö - 8 Petri Net Example (cont d) Here we have the same model as on the previous slides, but with limited buffer. The buffer size is three (number of initial tokens in B ) B B B Nr. of tokens in B : how many free slots are available in the buffer; Nr. of tokens in B: how many messages (tokens) are in the buffer. Total number of tokens in B and B is constant. B B B Some Features and Applications of Petri Nets Intuitive. Easy to express concurrency, synchronisation, nondeterminism. Nondeterminism is an important difference between Petri nets and dataflow! As an uninterpreted model, Petri Nets can be used for several, very different classes of problems. - Uninterpreted model: nothing has to be specified related to the particular activities associated to the transitions.

System Design&Methodologies Fö - 9 System Design&Methodologies Fö - 1 Some Features and Applications of Petri Nets (cont d) Properties and Analysis of Petri Nets Petri Nets have been intensively used for modeling and analysis of industrial production systems, information systems, but also - Computer architectures - Operating systems - Concurrent programs - Distributed systems Several properties of the system can be analysed using Petri nets: Boundedness: the number of tokens in a certain place does not exceed a given limit. If this limit is 1, the property is sometimes called safeness. - You can check that available resources are not exceeded. - Hardware systems System Design&Methodologies Fö - 11 System Design&Methodologies Fö - 12 Properties and Analysis of Petri Nets (cont d) Liveness: - A transition t is called live if for every possible marking there exists a chance for that transition to become enabled. The whole net is live, if all its transitions are live. - liveness is important in order to check that a system is not deadlocked. Properties and Analysis of Petri Nets (cont d) Mathematical tools are available for analysis of Petri Nets. The properties discussed above can be formally verified. Reachability: given a current marking M of the net, and another marking M, does there exist a sequence of transitions by which M can be obtained? - You can check that a certain desired state (marking) is reached. - You can check that a certain undesired state is never reached. Petri nets (like dataflow systems) are asynchronous concurrent. Events can happen at any time. There exists a partial order of events:

System Design&Methodologies Fö - 13 System Design&Methodologies Fö - 14 Extended Petri Net Models Basic Petri Net models have a limited expressive power. time-stamp Extended Petri Net Models (cont d) Timed Petri Nets - Transitions have associated times (time intervals) - Tokens are carrying time stamps. With timed Petri nets we can model the timing aspects Coloured Petri Nets - Tokens have associated s - Transitions have associated functions Coloured Petri Nets are similar to dataflow models (but also capture nondeterminism!). (, ) x (2, ) y x (2, ) y [1, ] 2 +3 [2, 7] [1, ] 2 +3 [2, 7] [1, ] 2 +3 [2, 7] (1,2) (1,2) (, 4) [1, 3] x> [2, 4] [1, 3] x> [2, 4] [1, 3] x> [2, 4] x-3 y+2 x-3 y+2 x-3 y+2 System Design&Methodologies Fö - 1 System Design&Methodologies Fö - 16 Extended Petri Net Models (cont d) Extended Petri Net Models (cont d) [1, ] 2 +3 [2, 7] [1, ] 2 +3 [2, 7] Extended Petri Nets have a larger expressive power then classical Petri Nets. Analysis is more complex; the formal analysis of properties can take unacceptably large amounts of time (memory). [1, 3] (1,6) x> [2, 4] [1, 3] x> [2, 4] x-3 y+2 x-3 y+2 (17,8) Simulation of the Petri Net can be used in order to verify the system and to estimate performance

System Design&Methodologies Fö - 17 System Design&Methodologies Fö - Summary Summary (cont d) Petri Nets are a mixture of dataflow and state-based model. Places hold the distributed state of the system (represented by the marking); transitions denote the activity of the system. Petri nets elegantly capture concurrency, synchronisation, and nondeterminism. A large class of problems can be solved using Petri Net modelling; system properties like boundedness, liveness, and reachability can be formally analysed. Petri nets, like dataflow, are asynchronous, concurrent models. Events can happen at any time; there exists a partial order of events. Basic Petri Nets are limited in their expressive power - in timed Petri Nets an explicit notion of time has been introduced; - in coloured Petri nets tokens have associated s. Formal reasoning about extended Petri Net models is very difficult because of complexity issues. Simulation of the models is often used for system validation. System Design&Methodologies Fö - 19 System Design&Methodologies Fö - 2 Discrete Event Models Discrete Event Models 1. What Is a Discrete Event Model? 2. Discrete Event Simulation The system is a collection of processes that respond to events. Each event carries a time-stamp indicating the time at which the event occurs. Time-stamps are totally ordered. 3. Efficiency of Discrete Event Simulation 4. Potential Ambiguities in Discrete Event Simulation A Discrete Event (DE) simulator maintains a global event queue sorted by the time-stamps. The simulator also keeps a single global time.

System Design&Methodologies Fö - 21 System Design&Methodologies Fö - 22 Discrete Event Simulator Discrete Event Simulator (cont d) time 1 time 2 time i This event will be generated and placed into the event queue at time t global_clock + 2 Global clock..... wait on..... S3 <=... Process P2..... <= after 2s..... wait on S3 Process P1 Any events left? Yes Advance global clock to t current, the time-stamp of the earliest event(s) in the event queue. Update the s of all events having time-stamp = t current. Activate and run all processes which are sensible to the updated events; each process will eventually reach a wait for a certain event and enter a wait state. The activated processes have generated new events; place these events at their right place in the event queue. No Simulation done! System Design&Methodologies Fö - 23 System Design&Methodologies Fö - 24 Discrete Event Simulation The discrete event model has been mainly used for system simulation. Several languages have been developed for system modeling based on the discrete event model. Most well known: - VHDL, Verilog (both used for hardware modeling), SystemC Efficient way to simulate distributed systems. In general, efficient for large systems with autonomous components, with relatively large idle times. Systems with non-regular, possibly long times between different activities. Why is this the case? Because DE simulation will only consider the particular times when a change in the system (an event) occurs. This is opposed to, for example, cycle-based models, where all clock-ticks are considered. Discrete Event Simulation (cont d) Efficiency related problems: Keeping the sorted event-queue is time-consuming. As the activity of the simulated system increases (a lot of events at a very high number of time moments have to be considered) the overhead becomes high simulation is slow. Event driven models are primarily employed for simulation. Functional verification Performance evaluation Both synthesis and formal verification are very difficult (complex) with DE models. - The classical trade-off between expressive power and the possibility of formal reasoning and efficient synthesis.

System Design&Methodologies Fö - 2 System Design&Methodologies Fö - 26 A Problem with Discrete Event Simulation Have a look at the diagram in slide 22: In the third step we have Activate and run all processes which are sensible to the updated events. If we have a set of several such processes ready to run, in which order should they be activated? The only acceptable answer: The order should not matter; whatever the order, the simulation result has to be the same! Otherwise, different simulators might provide different simulation outputs for the same model! <= after wait on <= after 1 wait on, 1 Initial s At time 1 executes 1 At time 1 Processes B and C are ready to execute System Design&Methodologies Fö - 27 System Design&Methodologies Fö - 28 <= after Scenario 1 B first, then C B executes, =, =, t=1 <= after Scenario 2 C first, then B C executes, =, =, t=1 B executes, =, =, t=1 wait on <= after 1 wait on, 2 C executes, =, =, t=1 At time 2 C executes, =, =, t=2 wait on <= after 1 wait on, 2 At time 2 C executes, =, =, t=2 The two scenarios are identical!!! How fine!!!

System Design&Methodologies Fö - 29 System Design&Methodologies Fö - 3 wait on <= <= after We have changed the example! No after clause! wait on, 1 Initial s At time 1 executes 1 At time 1 Processes B and C are ready to execute <= after wait on <= wait on, Scenario 1 B first, then C B executes, =, =, t=1 1 C executes, =, =, t=1 System Design&Methodologies Fö - 31 System Design&Methodologies Fö - 32 <= after wait on <= wait on, Scenario 2 C first, then B C executes, =, =, t=1 B executes, =, =, t=1 1 C executes, =, =, t=1 The two scenarios are different!!! How bad!!! We get into this problem due to the zero delay assignment to in! The new event is queued at the current simulation time (1), which leads to the potential ambiguity. Such an ambiguity creates problems. For example, different simulators will produce different output for the same model with identical inputs. A possible solution (used, for example, in VHDL and SystemC): A zero delay event will be registered at a time which is infinitesimally delayed relative to the current time. A delta delay will be introduced on the event the new event will be consumed in the following simulation cycle and not the current one.

System Design&Methodologies Fö - 33 System Design&Methodologies Fö - 34 <= after 1 At time 1 executes Initial s <= after Scenario 1 B first, then C B executes, =, =, t=1 wait on <= wait on, 1 At time 1 Processes B and C are ready to execute wait on <= wait on, 1(+δ) C executes, =, =, t=1 At time 1(+δ) C executes, =, =, t=1(+δ) System Design&Methodologies Fö - 3 System Design&Methodologies Fö - 36 <= after Scenario 2 C first, then B C executes, =, =, t=1 B executes, =, =, t=1 Summary Discrete Event is a very powerful modelling technique, in terms of expressive power. Models are concurrent and asynchronous. The timing model is also very general. Delays on computation or communication can be arbitrary. wait on <= wait on, 1(+δ) At time 1(+δ) C executes, =, =, t=1(+δ) The two scenarios are identical!!! How fine!!! We pay for the large expressive power by the reduced potential of formal reasoning and efficient synthesis. Discrete event models are mainly used for simulation. Simulation is based on maintaining a unique, sorted event queue. This can create problems with simulation efficiency for large system models. In order to avoid problems with zero delay computations, delta delays are used (e.g. in VHDL).