stochastic modeling and simulations - ТФБ · stochastic modeling and simulations stochastic...

44
Stochastic Modeling Stochastic Modeling and Simulations and Simulations and Simulations and Simulations Stochastic Petri Net Models Prof. Dr. P. Mitrevski 1

Upload: others

Post on 27-Jun-2020

22 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Stochastic Modeling and Simulations - ТФБ · Stochastic Modeling and Simulations Stochastic Petri Net Models ... The transitions in (pure) Petri nets are Introduction to Petri

Stochastic Modeling Stochastic Modeling and Simulationsand Simulationsand Simulationsand Simulations

Stochastic Petri Net Models

Prof. Dr. P. Mitrevski

1

Page 2: Stochastic Modeling and Simulations - ТФБ · Stochastic Modeling and Simulations Stochastic Petri Net Models ... The transitions in (pure) Petri nets are Introduction to Petri

� Assessment of performance, reliability and availability is a key step in the design, analysis and tuning of computer systems

� Example:◦ We have a multiprocessor system and we want to be sure it provides enough processing power◦ If we add a processor, how much better will performance get?◦ Could additional overhead make the performance worse?

IntroductionIntroduction

worse?◦ Could we get a performance improvement just by changing the scheduling of jobs?◦ How would adding a processor affect the reliability of the system(?) Would this make the system go down more often?◦ If so, would an increase in performance outweigh the decrease in reliability?

2

Page 3: Stochastic Modeling and Simulations - ТФБ · Stochastic Modeling and Simulations Stochastic Petri Net Models ... The transitions in (pure) Petri nets are Introduction to Petri

� Reliability◦ Ability of a component or system to function correctly over a specified period of time

� Availability◦ Probability that system is working at the instant t, regardless of the number of times it may have failed and been repaired in the interval (0, t)

� Performance◦ Ability of the system to carry out the work it is subject to, assuming that the system (or its components) does not fail

� Performability

IntroductionIntroduction

� Performability◦ A new modeling paradigm that can give combined reliability and performance measures� Systems may be able to survive the failure of one or more of their active components and continue to provide service at a reduced level (gracefully degrading systems). Such systems cannot adequately be modeled through separate reliability/availability or performance models

3

Page 4: Stochastic Modeling and Simulations - ТФБ · Stochastic Modeling and Simulations Stochastic Petri Net Models ... The transitions in (pure) Petri nets are Introduction to Petri

� Applicable to a wide range of modeling problems� Provide interesting reliability, availability, performance and performability models

� Difficulties:◦ State space can grow much faster than the number of components in the system being modeled, making it difficult to specify a model correctly◦ Far removed in shape and general feel from the system being modeled◦ System designers may find it hard to translate their problems into Markov models

Markov ModelsMarkov Models

◦ System designers may find it hard to translate their problems into Markov models

� These difficulties can be overcome by using a model with a form that is more concise and closer to a designer’s intuition about what a model should look like◦ One such model which is quite popular is the stochastic Petri net(!)

4

Page 5: Stochastic Modeling and Simulations - ТФБ · Stochastic Modeling and Simulations Stochastic Petri Net Models ... The transitions in (pure) Petri nets are Introduction to Petri

� A Petri net consists of places, transitions, arcs and tokens

� Tokens reside in places and move from one place to another along the arcs through the transitions

� A marking is the number of tokens in each place

� The transitions in (pure) Petri nets are

Introduction to Petri net modelsIntroduction to Petri net models

� The transitions in (pure) Petri nets are untimed – the interest is in studying sequences of transition firings

� A very common extension is the stochastic Petri net (SPN), in which the transitions are timed

5

Page 6: Stochastic Modeling and Simulations - ТФБ · Stochastic Modeling and Simulations Stochastic Petri Net Models ... The transitions in (pure) Petri nets are Introduction to Petri

SPN model for M/M/1/k queueSPN model for M/M/1/k queue

6

Page 7: Stochastic Modeling and Simulations - ТФБ · Stochastic Modeling and Simulations Stochastic Petri Net Models ... The transitions in (pure) Petri nets are Introduction to Petri

� If πmis the steady-state probability for state (marking) m of

the underlying Markov chain and nmis the number of tokens

in queue for marking m, the average number of tokens in queue is:∑ ×

m

mmnπ

ReachabilityReachability graph for SPN model graph for SPN model of M/M/1/k queueof M/M/1/k queue

� The steady-state probability that the queue is full is the steady-state probability that the place jobsource is empty. We can find this by adding together the steady-state probabilities for all of the markings that have no tokens in jobsource. There is just one such marking, (0,5).

m

7

Page 8: Stochastic Modeling and Simulations - ТФБ · Stochastic Modeling and Simulations Stochastic Petri Net Models ... The transitions in (pure) Petri nets are Introduction to Petri

SPN model for M/M/1 queueSPN model for M/M/1 queue

� The number of tokens in queue can grow indefinitely, so this SPN has an infinite number of markings

8

Page 9: Stochastic Modeling and Simulations - ТФБ · Stochastic Modeling and Simulations Stochastic Petri Net Models ... The transitions in (pure) Petri nets are Introduction to Petri

� Bag (multiset) – a set where members are allowed to appear multiple times

� Petri net marking – a bag whose elements are place names

� Petri net – 5-tuple (P,T,I(),O(),m0) where:◦ P is a set of places („места“)◦ T is a set of transitions („премини“)◦ I() is the input function – maps transitions to bags of places◦ O() is the output function – maps transitions to bag of

Petri net model definitions (1)Petri net model definitions (1)

◦ O() is the output function – maps transitions to bag of places◦ m0 is the initial marking of the net

� A transition t is enabled by a marking m if and only if I(t) is a subbag of m◦ Any transition t enabled by marking m can fire◦ When it fires, I(t) is subtracted from the marking m and O(t) is added to m, resulting in a new marking

9

Page 10: Stochastic Modeling and Simulations - ТФБ · Stochastic Modeling and Simulations Stochastic Petri Net Models ... The transitions in (pure) Petri nets are Introduction to Petri

Petri net examplePetri net example10

Page 11: Stochastic Modeling and Simulations - ТФБ · Stochastic Modeling and Simulations Stochastic Petri Net Models ... The transitions in (pure) Petri nets are Introduction to Petri

ReachabilityReachability graph for Petri net graph for Petri net exampleexample

11

Page 12: Stochastic Modeling and Simulations - ТФБ · Stochastic Modeling and Simulations Stochastic Petri Net Models ... The transitions in (pure) Petri nets are Introduction to Petri

� To associate time with transitions, we consider that a transition is enabled as soon as all required tokens are present in the required places, but the transition does not fire right away

� A transition’s firing time, which is specified by a distribution function, is measured from the instant the transition is enabled to the instant it actually fires

Petri net model definitions (2)Petri net model definitions (2)

it actually fires� A stochastic Petri net (SPN) is a Petri net with timed transitions, where the firing time distributions are assumed to be exponential

� Conflicting timed transitions are viewed as competing processes (“race policy”)

12

Page 13: Stochastic Modeling and Simulations - ТФБ · Stochastic Modeling and Simulations Stochastic Petri Net Models ... The transitions in (pure) Petri nets are Introduction to Petri

� A generalized stochastic Petri net (GSPN) is a PN where both immediate („миговни“) and timed („временски“)transitions are allowed

� A graphical representation of a GSPN (generally) shows immediate transitions as lines and timed transitions as thick bars or rectangular boxes

� When both immediate and timed transitions

Petri net model definitions (3)Petri net model definitions (3)

� When both immediate and timed transitions are enabled in a marking, only the immediate transitions can fire

� Conflicting immediate transitions are assigned relative firing probability values(“preselection policy”)

13

Page 14: Stochastic Modeling and Simulations - ТФБ · Stochastic Modeling and Simulations Stochastic Petri Net Models ... The transitions in (pure) Petri nets are Introduction to Petri

GSPN model for simultaneous GSPN model for simultaneous possesionpossesion of a resource: of a resource: I/O subsystem with two disks but only one I/O channelI/O subsystem with two disks but only one I/O channel

14

Page 15: Stochastic Modeling and Simulations - ТФБ · Stochastic Modeling and Simulations Stochastic Petri Net Models ... The transitions in (pure) Petri nets are Introduction to Petri

� Some of the extensions are a matter of convenience, especially regarding graphical representation, and some are true extensions that add modeling power:◦ Arc Multiplicity

Petri net extensionsPetri net extensions

◦ Arc Multiplicity

◦ Inhibitor Arcs

◦ Priorities

◦ Guards

◦ Marking-dependent arc multiplicity

◦ Marking-dependent firing rates

15

Page 16: Stochastic Modeling and Simulations - ТФБ · Stochastic Modeling and Simulations Stochastic Petri Net Models ... The transitions in (pure) Petri nets are Introduction to Petri

Example of Example of arc multiplicitiesarc multiplicities16

Page 17: Stochastic Modeling and Simulations - ТФБ · Stochastic Modeling and Simulations Stochastic Petri Net Models ... The transitions in (pure) Petri nets are Introduction to Petri

� An inhibitor arc from place p to transition tdisables t in any marking where p is not empty

SPN model with SPN model with inhibitor arcsinhibitor arcs for for M/M/1/k queueM/M/1/k queue

17

Page 18: Stochastic Modeling and Simulations - ТФБ · Stochastic Modeling and Simulations Stochastic Petri Net Models ... The transitions in (pure) Petri nets are Introduction to Petri

GSPN model for queue with two GSPN model for queue with two job classesjob classes

18

Page 19: Stochastic Modeling and Simulations - ТФБ · Stochastic Modeling and Simulations Stochastic Petri Net Models ... The transitions in (pure) Petri nets are Introduction to Petri

GSPN model with GSPN model with prioritiespriorities for for queue with four job classesqueue with four job classes

19

Page 20: Stochastic Modeling and Simulations - ТФБ · Stochastic Modeling and Simulations Stochastic Petri Net Models ... The transitions in (pure) Petri nets are Introduction to Petri

� A guard is a marking-dependent predicate that provides an additional enabling criterion for each transition: the transition is enabled only if the guard is satisfied

� SU=server up; SD=server down; BU=buffer up; BD=buffer down

� nm(Q) = number of jobs in the system

A GSPN using A GSPN using guardsguards20

Page 21: Stochastic Modeling and Simulations - ТФБ · Stochastic Modeling and Simulations Stochastic Petri Net Models ... The transitions in (pure) Petri nets are Introduction to Petri

� EXAMPLE: a PN model of a communication protocol where the arrival of a certain kind of packet causes all outgoing packets to be flushed

MarkingMarking--dependent arc multiplicity:dependent arc multiplicity:Flushing a placeFlushing a place

21

Page 22: Stochastic Modeling and Simulations - ТФБ · Stochastic Modeling and Simulations Stochastic Petri Net Models ... The transitions in (pure) Petri nets are Introduction to Petri

� The system is operational if k-out-of-n components are working

� If the failure rate for each component is λ, then when there are j

functional components, the rate of occurrence of a component failure is jλ, depicted by appending the character ‘#’ to the rate λ

MarkingMarking--dependent firing rates:dependent firing rates:GSPN model for kGSPN model for k--outout--ofof--n systemn system

22

Page 23: Stochastic Modeling and Simulations - ТФБ · Stochastic Modeling and Simulations Stochastic Petri Net Models ... The transitions in (pure) Petri nets are Introduction to Petri

� Most commonly used methods:◦ Generation and analysis of a stochastic process associated with the PN� Let M(t) be the SPN marking at time t� M(t) is a continuous time stochastic process called the marking process or stochastic process underlyingthe SPN

� The state space of the marking process is the reachability set of the SPN

� The analysis of the SPN for transient or steady-state measures is equivalent to the solution of the associated

SPN and SPN and GSPN analysis (1)GSPN analysis (1)

measures is equivalent to the solution of the associated Continuous Time Markov Chain (CTMC)

◦ Discrete-event simulation of the PN� Avoids the generation of the reachability graph and can help with very large PNs

� In addition, it becomes possible to handle non-Markovian nets

23

Page 24: Stochastic Modeling and Simulations - ТФБ · Stochastic Modeling and Simulations Stochastic Petri Net Models ... The transitions in (pure) Petri nets are Introduction to Petri

� Analyzing GSPNs is a bit more complicated because of the presence of immediate transitions

� A marking in which at least one immediate transition is enabled is called a vanishing („миговно“, „исчезнувачко“) marking; otherwise it is a tangible(„допирливо“) marking

SPN and GSPN analysis (2)SPN and GSPN analysis (2)

(„допирливо“) marking� The resulting graph is called an extended reachability graph (ERG) and can be transformed into a reduced reachabilitygraph that corresponds to a CTMC

24

Page 25: Stochastic Modeling and Simulations - ТФБ · Stochastic Modeling and Simulations Stochastic Petri Net Models ... The transitions in (pure) Petri nets are Introduction to Petri

A GSPNA GSPN25

Page 26: Stochastic Modeling and Simulations - ТФБ · Stochastic Modeling and Simulations Stochastic Petri Net Models ... The transitions in (pure) Petri nets are Introduction to Petri

ERG and CTMC of the GSPNERG and CTMC of the GSPN26

Page 27: Stochastic Modeling and Simulations - ТФБ · Stochastic Modeling and Simulations Stochastic Petri Net Models ... The transitions in (pure) Petri nets are Introduction to Petri

A GSPNA GSPN27

Page 28: Stochastic Modeling and Simulations - ТФБ · Stochastic Modeling and Simulations Stochastic Petri Net Models ... The transitions in (pure) Petri nets are Introduction to Petri

ERGERG28

Page 29: Stochastic Modeling and Simulations - ТФБ · Stochastic Modeling and Simulations Stochastic Petri Net Models ... The transitions in (pure) Petri nets are Introduction to Petri

� Pvv, Pvt = matrices of transition probabilities („матрици на веројатности на премин“)

� Ptt, Ptv = matrices of transition rates („матрици на интензитети на премин“)

� (t=tangible; v=vanishing)

Constructing the generator matrix Constructing the generator matrix for the underlying CTMC (1)for the underlying CTMC (1)

29

Page 30: Stochastic Modeling and Simulations - ТФБ · Stochastic Modeling and Simulations Stochastic Petri Net Models ... The transitions in (pure) Petri nets are Introduction to Petri

� The matrix describing the rates of transition from each tangible marking to other tangible markings is:

◦ U = Ptt + Ptv (I – Pvv)-1 Pvt

Constructing the generator matrix Constructing the generator matrix for the underlying CTMC (2)for the underlying CTMC (2)

� The entries in the generator matrix („карактеристична матрица“) for the underlying CTMC are:

30

Page 31: Stochastic Modeling and Simulations - ТФБ · Stochastic Modeling and Simulations Stochastic Petri Net Models ... The transitions in (pure) Petri nets are Introduction to Petri

� A system with two processors and three memory modules

� Processors and memory modules are subject to failure and can be repaired

� There is only one repair facility

� The system is unavailable if ppup is empty or pmup is empty

A GSPN availability modelA GSPN availability model31

Page 32: Stochastic Modeling and Simulations - ТФБ · Stochastic Modeling and Simulations Stochastic Petri Net Models ... The transitions in (pure) Petri nets are Introduction to Petri

� A single server handles more than one source of jobs (e.g. two)

� The system contains stations which the server polls one at a time

� If the server finds a job waiting for a service at a station, the job is servedIf there are no jobs

A GSPN model for a single service A GSPN model for a single service polling systempolling system

� If there are no jobs waiting at a station, the server goes on to poll the next station

� Mi = maximum number of jobs for Station i

32

Page 33: Stochastic Modeling and Simulations - ТФБ · Stochastic Modeling and Simulations Stochastic Petri Net Models ... The transitions in (pure) Petri nets are Introduction to Petri

� PE = processing element

� P = processor

� LM = local memory

� CM = common (shared) memory

� LB = local bus

� GB = global bus

A singleA single--bus multiprocessor bus multiprocessor systemsystem

33

Page 34: Stochastic Modeling and Simulations - ТФБ · Stochastic Modeling and Simulations Stochastic Petri Net Models ... The transitions in (pure) Petri nets are Introduction to Petri

� Three stages of a hypo-exponentially distributed service time

� Processing efficiency = average fraction of active processors in the system

◦ A processor is active if it is executing instructions in its private memory

GSPN for singleGSPN for single--bus bus multiprocessor systemmultiprocessor system

34

Page 35: Stochastic Modeling and Simulations - ТФБ · Stochastic Modeling and Simulations Stochastic Petri Net Models ... The transitions in (pure) Petri nets are Introduction to Petri

� A failed node is successfully bypassed with some probability 1-F

� The network as a whole fails if any one of the nodes or links fails

A ring networkA ring network35

Page 36: Stochastic Modeling and Simulations - ТФБ · Stochastic Modeling and Simulations Stochastic Petri Net Models ... The transitions in (pure) Petri nets are Introduction to Petri

GSPN model of ring networkGSPN model of ring network36

Page 37: Stochastic Modeling and Simulations - ТФБ · Stochastic Modeling and Simulations Stochastic Petri Net Models ... The transitions in (pure) Petri nets are Introduction to Petri

GSPN model for queue with server GSPN model for queue with server failure and repairfailure and repair

37

Page 38: Stochastic Modeling and Simulations - ТФБ · Stochastic Modeling and Simulations Stochastic Petri Net Models ... The transitions in (pure) Petri nets are Introduction to Petri

� Voice and packets arrive according to a Poisson process

� The transmitter contains a buffer to store a maximum of k data packets

� A voice packet can enter the channel only if there are no packets waiting to

ISDN channel with Poisson arrival ISDN channel with Poisson arrival processprocess

are no packets waiting to be transmitted

� If a voice transmission is in progress, data packets cannot be serviced, but are buffered

38

Page 39: Stochastic Modeling and Simulations - ТФБ · Stochastic Modeling and Simulations Stochastic Petri Net Models ... The transitions in (pure) Petri nets are Introduction to Petri

Queuing network with Queuing network with simultaneous resource possessionsimultaneous resource possession

39

Page 40: Stochastic Modeling and Simulations - ТФБ · Stochastic Modeling and Simulations Stochastic Petri Net Models ... The transitions in (pure) Petri nets are Introduction to Petri

GSPN model of queuing network GSPN model of queuing network with resource constraintswith resource constraints

40

Page 41: Stochastic Modeling and Simulations - ТФБ · Stochastic Modeling and Simulations Stochastic Petri Net Models ... The transitions in (pure) Petri nets are Introduction to Petri

� In a great number of real situations, deterministic or generally (non-exponentially) distributed event times occur◦ Timeouts in a protocol

◦ Service times in a manufacturing system performing the same task on each part

◦ Memory access or instruction execution in a low-level hardware or software

NonNon--MarkovianMarkovian SPN model SPN model extensions (1)extensions (1)

level hardware or software

� NOTE: they all have durations which are constant or have a very low variance(!)

41

Page 42: Stochastic Modeling and Simulations - ТФБ · Stochastic Modeling and Simulations Stochastic Petri Net Models ... The transitions in (pure) Petri nets are Introduction to Petri

� Extended Stochastic Petri nets (ESPN)◦ General firing time distributions are allowed◦ Under suitable hypotheses, the underlying stochastic process is a semi-Markov process and analytical solution methods exist

� Deterministic and Stochastic Petri nets (DSPN)◦ Allow the definition of immediate, exponential and deterministic transitions◦ The stochastic process underlying a DSPN is a

NonNon--MarkovianMarkovian SPN model SPN model extensions (2)extensions (2)

◦ The stochastic process underlying a DSPN is a Markov Regenerative Process (MRGP)◦ With the restriction that at most one deterministic transition is enabled together with zero or more exponentially distributed timed transitions, a steady-state and a transient solution method exist

42

Page 43: Stochastic Modeling and Simulations - ТФБ · Stochastic Modeling and Simulations Stochastic Petri Net Models ... The transitions in (pure) Petri nets are Introduction to Petri

� Markov Regenerative Stochastic Petri nets (MRSPN)◦ A generalization of DSPNs that allows immediate, exponential and generally distributed transitions◦ The underlying stochastic process is still an MRGP◦ There exist equations for the steady-state and transient behavior for the case where every marking has at most one generally distributed timed transition

� Concurrent Generalized Petri nets (CGPN)◦ Allow simultaneous enabling of any number of immediate, exponentially distributed and generally

NonNon--MarkovianMarkovian SPN model SPN model extensions (2)extensions (2)

immediate, exponentially distributed and generally distributed timed transitions, provided that the latter are all enabled at the same instant◦ The stochastic process underlying a CGPN is shown to be an MGRP◦ Equations for the steady-state as well transient analysis are provided

43

Page 44: Stochastic Modeling and Simulations - ТФБ · Stochastic Modeling and Simulations Stochastic Petri Net Models ... The transitions in (pure) Petri nets are Introduction to Petri

� Fluid Stochastic Petri nets (FSPN)◦ One or more places can hold fluid rather than discrete tokens

◦ The discrete and continuous portions may affect each other

� Able to both control the fluid flow, and have the discrete control decisions be affected by observed fluid flow

NonNon--MarkovianMarkovian SPN model SPN model extensions (3)extensions (3)

fluid flow

◦ The transient and the steady-state behavior of FSPNs is described by a coupled system of partial differential equations

44