dependability engineering & Petri nets May 2020 monika.heiner@b-tu.de 7 - 1 / 27
THE MUTEX PATTERN
- DIFFERENT
ANALYSIS APPROACHES
dependability engineering & Petri nets May 2020 monika.heiner@b-tu.de 7 - 2 / 27
THE analysis place / transition invariants state equation MUTEX - - PowerPoint PPT Presentation
dependability engineering & Petri nets May 2020 dependability engineering & Petri nets May 2020 QUALITATIVE ANALYSIS METHODS , OVERVIEW NET REDUCTION STRUCTURAL PROPERTIES LINEAR PROGRAMMING static THE analysis place / transition
dependability engineering & Petri nets May 2020 monika.heiner@b-tu.de 7 - 1 / 27
dependability engineering & Petri nets May 2020 monika.heiner@b-tu.de 7 - 2 / 27
dependability engineering & Petri nets May 2020 monika.heiner@b-tu.de 7 - 3 / 27
public class Semaphore { private int value; public Semaphore (int initial) { if (initial<0) { System.exit(1); // out of range error } else { value = initial; } // if } // Semaphore synchronized public void up() { ++value; notify(); } // up synchronized public void down() { try { while (value==0) wait();
} catch(InterruptedException e){} } // down } // class Semaphore
dependability engineering & Petri nets May 2020 monika.heiner@b-tu.de 7 - 4 / 27
class MutexLoop extends Thread { private Semaphore mutex; private char ch; MutexLoop (Semaphore sema, char toPrint) { mutex=sema; ch = toPrint; } // MutexLoop public void run() { for (int i=0;i<MutexDemo.LENGTH;i++) { Simulate.doSomething();// pre action mutex.down(); // get mutual exclusion System.out.println(); for (int j=0;j<MutexDemo.MAX;j++) { System.out.print(ch); } // for mutex.up(); //release mutual exclusion Simulate.doSomething();// post action } // for } // run } // class MutexLoop
dependability engineering & Petri nets May 2020 monika.heiner@b-tu.de 7 - 5 / 27
mutex mutex down forI up mutex
forI doSomething endForI endMutexLoo beginMutexLoop mutex endForJ print(ch) forJ println() beginMutexLoop endMutexLoop endForI doSomething forI down up mutex mutex up down inMutex begin
mutex mutex up
down
dependability engineering & Petri nets May 2020 monika.heiner@b-tu.de 7 - 6 / 27
public class MutexDemo { static final int MAX = 30;// line width to weave static final int LENGTH = 50;// number of lines public static void main (String[] argv) { Semaphore mutex = new Semaphore(1); Thread a = new MutexLoop(mutex,'a'); Thread b = new MutexLoop(mutex,'b'); // Thread c = new MutexLoop(mutex,'c'); System.out.println(" -- begin of MutexDemo -- "); a.start(); b.start(); // c.start(); } // main } // class MutexDemo
dependability engineering & Petri nets May 2020 monika.heiner@b-tu.de 7 - 7 / 27
B_inMutex B_up B_down A_inMutex A_up A_down mutex A_begin B_begin
B_begin A_begin mutex
ORD HOM NBM PUR CSV SCF CON SC Ft0 tF0 Fp0 pF0 MG SM FC EFC ES Y Y Y Y N N Y Y N N N N N N N N Y DTP SMC SMD SMA CPI CTI B SB REV DSt BSt DTr DCF L LV L&S Y Y Y Y Y Y Y Y Y N ? N N Y Y Y
dependability engineering & Petri nets May 2020 monika.heiner@b-tu.de 7 - 8 / 27
B_up _T0_ B_down _T1_ A_up _T2_ A_down _T3_ B_inMutex _P1_ A_inMutex _P4_ mutex _P0_ A_begin _P3_ B_begin _P2_
dependability engineering & Petri nets May 2020 monika.heiner@b-tu.de 7 - 9 / 27
dependability engineering & Petri nets May 2020 monika.heiner@b-tu.de 7 - 10 / 27
P T t1 tj tm p1 pi pn cij POST - PRE P+T P+T t1 p1 card(P) card(T) p1 t1 card(T) card(P) + POST
. . . . . . . . . . . .
dependability engineering & Petri nets May 2020 monika.heiner@b-tu.de 7 - 11 / 27
B_up _T0_ B_down _T1_ A_up _T2_ A_down _T3_ B_inMutex _P1_ A_inMutex _P4_ mutex _P0_ A_begin _P3_ B_begin _P2_
A_begin mutex B_inMutex B_begin A_inMutex B_up B_down A_up A_down P T
+1 +1
+1
+1
+1
+1
dependability engineering & Petri nets May 2020 monika.heiner@b-tu.de 7 - 12 / 27
P T t1 tj tm p1 pi pn
incidence matrix C
∆tj
∆tj - vector describing the change of the whole marking by firing of tj
C 1 tj ∆tj . . . . . . . .
PARIKH VECTOR
C 1 t0 ∆w . . . . . .
PARIKH VECTOR
2 t1
parikh(w) parikh(tj)
dependability engineering & Petri nets May 2020 monika.heiner@b-tu.de 7 - 13 / 27
C 1 t0 ∆w . . . . . . 2 t1
+ = mo m m0 - initial marking m
NON-REACHABILITY CHECK
dependability engineering & Petri nets May 2020 monika.heiner@b-tu.de 7 - 14 / 27
+1 +1
+1
+1
+1
+1 + = 1 1 1 1 1 m m0 C * x x0 x1 x2 x3
= + x0
+ x2
1 =
+ x1
= + x0
= + x2
1 =
+ x3
dependability engineering & Petri nets May 2020 monika.heiner@b-tu.de 7 - 15 / 27
dependability engineering & Petri nets May 2020 monika.heiner@b-tu.de 7 - 16 / 27
dependability engineering & Petri nets May 2020 monika.heiner@b-tu.de 7 - 17 / 27
dependability engineering & Petri nets May 2020 monika.heiner@b-tu.de 7 - 18 / 27
dependability engineering & Petri nets May 2020 monika.heiner@b-tu.de 7 - 19 / 27
dependability engineering & Petri nets May 2020 monika.heiner@b-tu.de 7 - 20 / 27
dependability engineering & Petri nets May 2020 monika.heiner@b-tu.de 7 - 21 / 27
≤
dependability engineering & Petri nets May 2020 monika.heiner@b-tu.de 7 - 22 / 27
dependability engineering & Petri nets May 2020 monika.heiner@b-tu.de 7 - 23 / 27
b2 b1 r a1 a2 c2 c1 bp bg ag ap cp cg
dependability engineering & Petri nets May 2020 monika.heiner@b-tu.de 7 - 24 / 27
b2 b1 r a1 a2 c2 c1 bp bg ag ap cp cg b2 b1 r a1 a2 c2 c1 bp bg ag ap cp cg b2 b1 r a1 a2 c2 c1 bp bg ag ap cp cg
dependability engineering & Petri nets May 2020 monika.heiner@b-tu.de 7 - 25 / 27
dependability engineering & Petri nets May 2020 monika.heiner@b-tu.de 7 - 26 / 27
dependability engineering & Petri nets May 2020 monika.heiner@b-tu.de 7 - 27 / 27
[Desel 1998] Desel, J.: Petrinetze, lineare Algebra und lineare Programmierung;
[Heiner 2008] M Heiner, D Gilbert and R Donaldson: Petri Nets for Systems and Synthetic Biology; SFM 2008, Bertinoro, Springer, LNCS 5016, pages 215–264. [Heiner 2009] M Heiner: Understanding Network Behaviour by Structured Representations of Transition Invariants – A Petri Net Perspective on Systems and Synthetic Biology; Algorithmic Bioprocesses, Springer, pages 367–389, 2009. [Starke 1990] Starke, P. H.: Analyse von Petri-Netz-Modellen;