Petri Nets Copyright, 2003 © Jerzy R. Nawrocki [email protected] Models and Analysis of...
-
Upload
curtis-chambers -
Category
Documents
-
view
217 -
download
0
Transcript of Petri Nets Copyright, 2003 © Jerzy R. Nawrocki [email protected] Models and Analysis of...
![Page 1: Petri Nets Copyright, 2003 © Jerzy R. Nawrocki Jerzy.Nawrocki@put.poznan.pl Models and Analysis of Software Lecture.](https://reader035.fdocuments.net/reader035/viewer/2022062718/56649ebf5503460f94bc9122/html5/thumbnails/1.jpg)
Petri NetsPetri Nets
Copyright, 2003 © Jerzy R. Nawrocki
www.cs.put.poznan.pl/jnawrocki/mse/mss/
Models and Analysis of Software Models and Analysis of Software
Lecture 7Lecture 7
Models and Analysis of Software Models and Analysis of Software
Lecture 7Lecture 7
![Page 2: Petri Nets Copyright, 2003 © Jerzy R. Nawrocki Jerzy.Nawrocki@put.poznan.pl Models and Analysis of Software Lecture.](https://reader035.fdocuments.net/reader035/viewer/2022062718/56649ebf5503460f94bc9122/html5/thumbnails/2.jpg)
J. Nawrocki, Models & Analysis of Soft.
From the previous lecture..From the previous lecture..From the previous lecture..From the previous lecture..
A Be(c) / a
e - event
c - conditiona - actionExamples:
• sending a signal,• assignment statement.
Action:
• an instantaneous occurrence
• ideally takes zero time.
![Page 3: Petri Nets Copyright, 2003 © Jerzy R. Nawrocki Jerzy.Nawrocki@put.poznan.pl Models and Analysis of Software Lecture.](https://reader035.fdocuments.net/reader035/viewer/2022062718/56649ebf5503460f94bc9122/html5/thumbnails/3.jpg)
J. Nawrocki, Models & Analysis of Soft.
From the previous lecture..From the previous lecture..From the previous lecture..From the previous lecture..
whilewhile (a != b) (a != b)
ifif (a > b) (a > b)
a -= b;a -= b;
elseelse b -= a; b -= a;
whilewhile (a != b) (a != b)
ifif (a > b) (a > b)
a -= b;a -= b;
elseelse b -= a; b -= a;
E
S
Loop
A B
(a>b) /a-=b
(b>a) /b-=a
B
(a=b)
a:a:
b:b:
![Page 4: Petri Nets Copyright, 2003 © Jerzy R. Nawrocki Jerzy.Nawrocki@put.poznan.pl Models and Analysis of Software Lecture.](https://reader035.fdocuments.net/reader035/viewer/2022062718/56649ebf5503460f94bc9122/html5/thumbnails/4.jpg)
J. Nawrocki, Models & Analysis of Soft.
OrthogonalityOrthogonalityOrthogonalityOrthogonality
B
C
(in G)
AE
F
G
D
![Page 5: Petri Nets Copyright, 2003 © Jerzy R. Nawrocki Jerzy.Nawrocki@put.poznan.pl Models and Analysis of Software Lecture.](https://reader035.fdocuments.net/reader035/viewer/2022062718/56649ebf5503460f94bc9122/html5/thumbnails/5.jpg)
J. Nawrocki, Models & Analysis of Soft.
From the previous lecture..From the previous lecture..From the previous lecture..From the previous lecture..
Activity:• similar to action but• takes a nonzero amount of time
Examples:• reading input• beeping• displaying• lengthy computations
![Page 6: Petri Nets Copyright, 2003 © Jerzy R. Nawrocki Jerzy.Nawrocki@put.poznan.pl Models and Analysis of Software Lecture.](https://reader035.fdocuments.net/reader035/viewer/2022062718/56649ebf5503460f94bc9122/html5/thumbnails/6.jpg)
J. Nawrocki, Models & Analysis of Soft.
Plan of the lecturePlan of the lecturePlan of the lecturePlan of the lecture
• From the previous lecture..
• Introduction• Simple examples• Concurrent transitions• Transitions in conflict• Another example• Readers and writers• Properties of Petri Nets
![Page 7: Petri Nets Copyright, 2003 © Jerzy R. Nawrocki Jerzy.Nawrocki@put.poznan.pl Models and Analysis of Software Lecture.](https://reader035.fdocuments.net/reader035/viewer/2022062718/56649ebf5503460f94bc9122/html5/thumbnails/7.jpg)
J. Nawrocki, Models & Analysis of Soft.
Carl Adam PetriCarl Adam PetriCarl Adam PetriCarl Adam Petri
Born on July, 12, 1926 in Leipzig
Since 1988:Honorary Prof. at the Univ. of Hamburg
Kommunikation mit Automaten. Petri, C.A., Bonn: Institut für Instrumentelle Mathematik, Schriften des IIM Nr. 2, 1962, Second Edition:, New York: Griffiss Air Force Base, Technical Report RADC-TR-65--377, Vol.1, 1966, English translation.
![Page 8: Petri Nets Copyright, 2003 © Jerzy R. Nawrocki Jerzy.Nawrocki@put.poznan.pl Models and Analysis of Software Lecture.](https://reader035.fdocuments.net/reader035/viewer/2022062718/56649ebf5503460f94bc9122/html5/thumbnails/8.jpg)
J. Nawrocki, Models & Analysis of Soft.
IntroductionIntroductionIntroductionIntroduction
Petri nets:• a graphical language• a good mathematical
background
Applications:• modelling concurrent and/or
distributed systems• communication protocols,
computer networks, manufacturing system, public transport systems etc.
![Page 9: Petri Nets Copyright, 2003 © Jerzy R. Nawrocki Jerzy.Nawrocki@put.poznan.pl Models and Analysis of Software Lecture.](https://reader035.fdocuments.net/reader035/viewer/2022062718/56649ebf5503460f94bc9122/html5/thumbnails/9.jpg)
J. Nawrocki, Models & Analysis of Soft.
TerminologyTerminologyTerminologyTerminology
A placeA place
A transitionA transition
A tokenA token
An inputAn input
arcarc
An outputAn output
arcarc
![Page 10: Petri Nets Copyright, 2003 © Jerzy R. Nawrocki Jerzy.Nawrocki@put.poznan.pl Models and Analysis of Software Lecture.](https://reader035.fdocuments.net/reader035/viewer/2022062718/56649ebf5503460f94bc9122/html5/thumbnails/10.jpg)
J. Nawrocki, Models & Analysis of Soft.
Plan of the lecturePlan of the lecturePlan of the lecturePlan of the lecture
• From the previous lecture..• Introduction
• Simple examples• Concurrent transitions• Transitions in conflict• Another example• Readers and writers• Properties of Petri Nets
![Page 11: Petri Nets Copyright, 2003 © Jerzy R. Nawrocki Jerzy.Nawrocki@put.poznan.pl Models and Analysis of Software Lecture.](https://reader035.fdocuments.net/reader035/viewer/2022062718/56649ebf5503460f94bc9122/html5/thumbnails/11.jpg)
J. Nawrocki, Models & Analysis of Soft.
A very simple exampleA very simple exampleA very simple exampleA very simple example
A reader in a library:• waiting,• reading.
waiting
reading
strt_reading
stop_reading
![Page 12: Petri Nets Copyright, 2003 © Jerzy R. Nawrocki Jerzy.Nawrocki@put.poznan.pl Models and Analysis of Software Lecture.](https://reader035.fdocuments.net/reader035/viewer/2022062718/56649ebf5503460f94bc9122/html5/thumbnails/12.jpg)
J. Nawrocki, Models & Analysis of Soft.
A very simple exampleA very simple exampleA very simple exampleA very simple example
A reader in a library:• waiting,• reading.
waiting
reading
strt_reading
stop_reading
![Page 13: Petri Nets Copyright, 2003 © Jerzy R. Nawrocki Jerzy.Nawrocki@put.poznan.pl Models and Analysis of Software Lecture.](https://reader035.fdocuments.net/reader035/viewer/2022062718/56649ebf5503460f94bc9122/html5/thumbnails/13.jpg)
J. Nawrocki, Models & Analysis of Soft.
A very simple exampleA very simple exampleA very simple exampleA very simple example
A reader in a library:• waiting,• reading.
waiting
reading
strt_reading
stop_reading
![Page 14: Petri Nets Copyright, 2003 © Jerzy R. Nawrocki Jerzy.Nawrocki@put.poznan.pl Models and Analysis of Software Lecture.](https://reader035.fdocuments.net/reader035/viewer/2022062718/56649ebf5503460f94bc9122/html5/thumbnails/14.jpg)
J. Nawrocki, Models & Analysis of Soft.
A very simple exampleA very simple exampleA very simple exampleA very simple example
A reader in a library:• waiting,• reading.
waiting
reading
strt_reading
stop_reading
![Page 15: Petri Nets Copyright, 2003 © Jerzy R. Nawrocki Jerzy.Nawrocki@put.poznan.pl Models and Analysis of Software Lecture.](https://reader035.fdocuments.net/reader035/viewer/2022062718/56649ebf5503460f94bc9122/html5/thumbnails/15.jpg)
J. Nawrocki, Models & Analysis of Soft.
A very simple exampleA very simple exampleA very simple exampleA very simple example
A reader in a library:• waiting,• reading.
waiting
reading
strt_reading
stop_reading
![Page 16: Petri Nets Copyright, 2003 © Jerzy R. Nawrocki Jerzy.Nawrocki@put.poznan.pl Models and Analysis of Software Lecture.](https://reader035.fdocuments.net/reader035/viewer/2022062718/56649ebf5503460f94bc9122/html5/thumbnails/16.jpg)
J. Nawrocki, Models & Analysis of Soft.
waiting
reading
strt_reading
stop_reading
Another simple exampleAnother simple exampleAnother simple exampleAnother simple example
Two readers in a library:
• waiting,• reading.
![Page 17: Petri Nets Copyright, 2003 © Jerzy R. Nawrocki Jerzy.Nawrocki@put.poznan.pl Models and Analysis of Software Lecture.](https://reader035.fdocuments.net/reader035/viewer/2022062718/56649ebf5503460f94bc9122/html5/thumbnails/17.jpg)
J. Nawrocki, Models & Analysis of Soft.
waiting
reading
strt_reading
stop_reading
Another simple exampleAnother simple exampleAnother simple exampleAnother simple example
Two readers in a library:
• waiting,• reading.
![Page 18: Petri Nets Copyright, 2003 © Jerzy R. Nawrocki Jerzy.Nawrocki@put.poznan.pl Models and Analysis of Software Lecture.](https://reader035.fdocuments.net/reader035/viewer/2022062718/56649ebf5503460f94bc9122/html5/thumbnails/18.jpg)
J. Nawrocki, Models & Analysis of Soft.
waiting
reading
strt_reading
stop_reading
Another simple exampleAnother simple exampleAnother simple exampleAnother simple example
Two readers in a library:
• waiting,• reading.
![Page 19: Petri Nets Copyright, 2003 © Jerzy R. Nawrocki Jerzy.Nawrocki@put.poznan.pl Models and Analysis of Software Lecture.](https://reader035.fdocuments.net/reader035/viewer/2022062718/56649ebf5503460f94bc9122/html5/thumbnails/19.jpg)
J. Nawrocki, Models & Analysis of Soft.
waiting
reading
strt_reading
stop_reading
Another simple exampleAnother simple exampleAnother simple exampleAnother simple example
Two readers in a library:
• waiting,• reading.
![Page 20: Petri Nets Copyright, 2003 © Jerzy R. Nawrocki Jerzy.Nawrocki@put.poznan.pl Models and Analysis of Software Lecture.](https://reader035.fdocuments.net/reader035/viewer/2022062718/56649ebf5503460f94bc9122/html5/thumbnails/20.jpg)
J. Nawrocki, Models & Analysis of Soft.
Plan of the lecturePlan of the lecturePlan of the lecturePlan of the lecture
• From the previous lecture..• Introduction• Simple examples
• Concurrent transitions• Transitions in conflict• Another example• Readers and writers• Properties of Petri Nets
![Page 21: Petri Nets Copyright, 2003 © Jerzy R. Nawrocki Jerzy.Nawrocki@put.poznan.pl Models and Analysis of Software Lecture.](https://reader035.fdocuments.net/reader035/viewer/2022062718/56649ebf5503460f94bc9122/html5/thumbnails/21.jpg)
J. Nawrocki, Models & Analysis of Soft.
Concurrent transitionsConcurrent transitionsConcurrent transitionsConcurrent transitions
2
![Page 22: Petri Nets Copyright, 2003 © Jerzy R. Nawrocki Jerzy.Nawrocki@put.poznan.pl Models and Analysis of Software Lecture.](https://reader035.fdocuments.net/reader035/viewer/2022062718/56649ebf5503460f94bc9122/html5/thumbnails/22.jpg)
J. Nawrocki, Models & Analysis of Soft.
Concurrent transitionsConcurrent transitionsConcurrent transitionsConcurrent transitions
2
![Page 23: Petri Nets Copyright, 2003 © Jerzy R. Nawrocki Jerzy.Nawrocki@put.poznan.pl Models and Analysis of Software Lecture.](https://reader035.fdocuments.net/reader035/viewer/2022062718/56649ebf5503460f94bc9122/html5/thumbnails/23.jpg)
J. Nawrocki, Models & Analysis of Soft.
Concurrent transitionsConcurrent transitionsConcurrent transitionsConcurrent transitions
2
![Page 24: Petri Nets Copyright, 2003 © Jerzy R. Nawrocki Jerzy.Nawrocki@put.poznan.pl Models and Analysis of Software Lecture.](https://reader035.fdocuments.net/reader035/viewer/2022062718/56649ebf5503460f94bc9122/html5/thumbnails/24.jpg)
J. Nawrocki, Models & Analysis of Soft.
Plan of the lecturePlan of the lecturePlan of the lecturePlan of the lecture
• From the previous lecture..• Introduction• Simple examples• Concurrent transitions
• Transitions in conflict• Another example• Readers and writers• Properties of Petri Nets
![Page 25: Petri Nets Copyright, 2003 © Jerzy R. Nawrocki Jerzy.Nawrocki@put.poznan.pl Models and Analysis of Software Lecture.](https://reader035.fdocuments.net/reader035/viewer/2022062718/56649ebf5503460f94bc9122/html5/thumbnails/25.jpg)
J. Nawrocki, Models & Analysis of Soft.
Transitions in conflictTransitions in conflictTransitions in conflictTransitions in conflict
![Page 26: Petri Nets Copyright, 2003 © Jerzy R. Nawrocki Jerzy.Nawrocki@put.poznan.pl Models and Analysis of Software Lecture.](https://reader035.fdocuments.net/reader035/viewer/2022062718/56649ebf5503460f94bc9122/html5/thumbnails/26.jpg)
J. Nawrocki, Models & Analysis of Soft.
Transitions in conflictTransitions in conflictTransitions in conflictTransitions in conflict
![Page 27: Petri Nets Copyright, 2003 © Jerzy R. Nawrocki Jerzy.Nawrocki@put.poznan.pl Models and Analysis of Software Lecture.](https://reader035.fdocuments.net/reader035/viewer/2022062718/56649ebf5503460f94bc9122/html5/thumbnails/27.jpg)
J. Nawrocki, Models & Analysis of Soft.
Transitions in conflictTransitions in conflictTransitions in conflictTransitions in conflict
A decision pointA decision point
![Page 28: Petri Nets Copyright, 2003 © Jerzy R. Nawrocki Jerzy.Nawrocki@put.poznan.pl Models and Analysis of Software Lecture.](https://reader035.fdocuments.net/reader035/viewer/2022062718/56649ebf5503460f94bc9122/html5/thumbnails/28.jpg)
J. Nawrocki, Models & Analysis of Soft.
Plan of the lecturePlan of the lecturePlan of the lecturePlan of the lecture
• From the previous lecture..• Introduction• Simple examples• Concurrent transitions• Transitions in conflict
• Another example• Readers and writers• Properties of Petri Nets
![Page 29: Petri Nets Copyright, 2003 © Jerzy R. Nawrocki Jerzy.Nawrocki@put.poznan.pl Models and Analysis of Software Lecture.](https://reader035.fdocuments.net/reader035/viewer/2022062718/56649ebf5503460f94bc9122/html5/thumbnails/29.jpg)
J. Nawrocki, Models & Analysis of Soft.
Another exampleAnother exampleAnother exampleAnother example
while (true)
{
t1;
. . .
t2;
. . .
t3;
}
while (.. t4 ..)
{
... t5; ...
}
Client
Server
![Page 30: Petri Nets Copyright, 2003 © Jerzy R. Nawrocki Jerzy.Nawrocki@put.poznan.pl Models and Analysis of Software Lecture.](https://reader035.fdocuments.net/reader035/viewer/2022062718/56649ebf5503460f94bc9122/html5/thumbnails/30.jpg)
J. Nawrocki, Models & Analysis of Soft.
Another exampleAnother exampleAnother exampleAnother example
while (1)
{
t1;
. . .
t2;
. . .
t3;
}
while (..t4..)
{
... t5; ...
}
t1
t2
t3
t4t5
![Page 31: Petri Nets Copyright, 2003 © Jerzy R. Nawrocki Jerzy.Nawrocki@put.poznan.pl Models and Analysis of Software Lecture.](https://reader035.fdocuments.net/reader035/viewer/2022062718/56649ebf5503460f94bc9122/html5/thumbnails/31.jpg)
J. Nawrocki, Models & Analysis of Soft.
Another exampleAnother exampleAnother exampleAnother example
while (1)
{
t1;
. . .
t2;
. . .
t3;
}
while (..t4..)
{
... t5; ...
}
t1
t2
t3
t4t5
![Page 32: Petri Nets Copyright, 2003 © Jerzy R. Nawrocki Jerzy.Nawrocki@put.poznan.pl Models and Analysis of Software Lecture.](https://reader035.fdocuments.net/reader035/viewer/2022062718/56649ebf5503460f94bc9122/html5/thumbnails/32.jpg)
J. Nawrocki, Models & Analysis of Soft.
Another exampleAnother exampleAnother exampleAnother example
while (1)
{
t1;
. . .
t2;
. . .
t3;
}
while (..t4..)
{
... t5; ...
}
t1
t2
t3
t4t5
![Page 33: Petri Nets Copyright, 2003 © Jerzy R. Nawrocki Jerzy.Nawrocki@put.poznan.pl Models and Analysis of Software Lecture.](https://reader035.fdocuments.net/reader035/viewer/2022062718/56649ebf5503460f94bc9122/html5/thumbnails/33.jpg)
J. Nawrocki, Models & Analysis of Soft.
Another exampleAnother exampleAnother exampleAnother example
while (1)
{
t1;
. . .
t2;
. . .
t3;
}
while (..t4..)
{
... t5; ...
}
t1
t2
t3
t4t5
![Page 34: Petri Nets Copyright, 2003 © Jerzy R. Nawrocki Jerzy.Nawrocki@put.poznan.pl Models and Analysis of Software Lecture.](https://reader035.fdocuments.net/reader035/viewer/2022062718/56649ebf5503460f94bc9122/html5/thumbnails/34.jpg)
J. Nawrocki, Models & Analysis of Soft.
Another exampleAnother exampleAnother exampleAnother example
while (1)
{
t1;
. . .
t2;
. . .
t3;
}
while (..t4..)
{
... t5; ...
}
t1
t2
t3
t4t5
![Page 35: Petri Nets Copyright, 2003 © Jerzy R. Nawrocki Jerzy.Nawrocki@put.poznan.pl Models and Analysis of Software Lecture.](https://reader035.fdocuments.net/reader035/viewer/2022062718/56649ebf5503460f94bc9122/html5/thumbnails/35.jpg)
J. Nawrocki, Models & Analysis of Soft.
Another exampleAnother exampleAnother exampleAnother example
while (1)
{
t1;
. . .
t2;
. . .
t3;
}
while (..t4..)
{
... t5; ...
}
t1
t2
t3
t4t5
![Page 36: Petri Nets Copyright, 2003 © Jerzy R. Nawrocki Jerzy.Nawrocki@put.poznan.pl Models and Analysis of Software Lecture.](https://reader035.fdocuments.net/reader035/viewer/2022062718/56649ebf5503460f94bc9122/html5/thumbnails/36.jpg)
J. Nawrocki, Models & Analysis of Soft.
Another exampleAnother exampleAnother exampleAnother example
while (1)
{
t1;
. . .
t2;
. . .
t3;
}
while (..t4..)
{
... t5; ...
}
t1
t2
t3
t4t5
![Page 37: Petri Nets Copyright, 2003 © Jerzy R. Nawrocki Jerzy.Nawrocki@put.poznan.pl Models and Analysis of Software Lecture.](https://reader035.fdocuments.net/reader035/viewer/2022062718/56649ebf5503460f94bc9122/html5/thumbnails/37.jpg)
J. Nawrocki, Models & Analysis of Soft.
Another exampleAnother exampleAnother exampleAnother example
while (1)
{
t1;
. . .
t2;
. . .
t3;
}
while (..t4..)
{
... t5; ...
}
t1
t2
t3
t4t5
![Page 38: Petri Nets Copyright, 2003 © Jerzy R. Nawrocki Jerzy.Nawrocki@put.poznan.pl Models and Analysis of Software Lecture.](https://reader035.fdocuments.net/reader035/viewer/2022062718/56649ebf5503460f94bc9122/html5/thumbnails/38.jpg)
J. Nawrocki, Models & Analysis of Soft.
Another exampleAnother exampleAnother exampleAnother example
while (1)
{
t1;
. . .
t2;
. . .
t3;
}
while (..t4..)
{
... t5; ...
}
t1
t2
t3
t4t5
![Page 39: Petri Nets Copyright, 2003 © Jerzy R. Nawrocki Jerzy.Nawrocki@put.poznan.pl Models and Analysis of Software Lecture.](https://reader035.fdocuments.net/reader035/viewer/2022062718/56649ebf5503460f94bc9122/html5/thumbnails/39.jpg)
J. Nawrocki, Models & Analysis of Soft.
Another exampleAnother exampleAnother exampleAnother example
while (1)
{
t1;
. . .
t2;
. . .
t3;
}
while (..t4..)
{
... t5; ...
}
t1
t2
t3
t4t5
![Page 40: Petri Nets Copyright, 2003 © Jerzy R. Nawrocki Jerzy.Nawrocki@put.poznan.pl Models and Analysis of Software Lecture.](https://reader035.fdocuments.net/reader035/viewer/2022062718/56649ebf5503460f94bc9122/html5/thumbnails/40.jpg)
J. Nawrocki, Models & Analysis of Soft.
Another exampleAnother exampleAnother exampleAnother example
while (1)
{
t1;
. . .
t2;
. . .
t3;
}
while (..t4..)
{
... t5; ...
}
t1
t2
t3
t4t5
![Page 41: Petri Nets Copyright, 2003 © Jerzy R. Nawrocki Jerzy.Nawrocki@put.poznan.pl Models and Analysis of Software Lecture.](https://reader035.fdocuments.net/reader035/viewer/2022062718/56649ebf5503460f94bc9122/html5/thumbnails/41.jpg)
J. Nawrocki, Models & Analysis of Soft.
Another exampleAnother exampleAnother exampleAnother example
while (1)
{
t1;
. . .
t2;
. . .
t3;
}
while (..t4..)
{
... t5; ...
}
t1
t2
t3
t4t5
(t1 (t2 || t4 (t5 t4)*) t3)*
![Page 42: Petri Nets Copyright, 2003 © Jerzy R. Nawrocki Jerzy.Nawrocki@put.poznan.pl Models and Analysis of Software Lecture.](https://reader035.fdocuments.net/reader035/viewer/2022062718/56649ebf5503460f94bc9122/html5/thumbnails/42.jpg)
J. Nawrocki, Models & Analysis of Soft.
Plan of the lecturePlan of the lecturePlan of the lecturePlan of the lecture
• From the previous lecture..• Introduction• Simple examples• Concurrent transitions• Transitions in conflict• Another example
• Readers and writers• Properties of Petri Nets
![Page 43: Petri Nets Copyright, 2003 © Jerzy R. Nawrocki Jerzy.Nawrocki@put.poznan.pl Models and Analysis of Software Lecture.](https://reader035.fdocuments.net/reader035/viewer/2022062718/56649ebf5503460f94bc9122/html5/thumbnails/43.jpg)
J. Nawrocki, Models & Analysis of Soft.
Readers and writersReaders and writersReaders and writersReaders and writers
while(1) { Read(d); Use(d); }
while(1) { Think(d); Write(d); }
![Page 44: Petri Nets Copyright, 2003 © Jerzy R. Nawrocki Jerzy.Nawrocki@put.poznan.pl Models and Analysis of Software Lecture.](https://reader035.fdocuments.net/reader035/viewer/2022062718/56649ebf5503460f94bc9122/html5/thumbnails/44.jpg)
J. Nawrocki, Models & Analysis of Soft.
Readers and writersReaders and writersReaders and writersReaders and writers
LibraryLibrary
![Page 45: Petri Nets Copyright, 2003 © Jerzy R. Nawrocki Jerzy.Nawrocki@put.poznan.pl Models and Analysis of Software Lecture.](https://reader035.fdocuments.net/reader035/viewer/2022062718/56649ebf5503460f94bc9122/html5/thumbnails/45.jpg)
J. Nawrocki, Models & Analysis of Soft.
Readers and writersReaders and writersReaders and writersReaders and writers
LibraryLibrary
![Page 46: Petri Nets Copyright, 2003 © Jerzy R. Nawrocki Jerzy.Nawrocki@put.poznan.pl Models and Analysis of Software Lecture.](https://reader035.fdocuments.net/reader035/viewer/2022062718/56649ebf5503460f94bc9122/html5/thumbnails/46.jpg)
J. Nawrocki, Models & Analysis of Soft.
Readers and writersReaders and writersReaders and writersReaders and writers
while(1) { Read(d); Use(d); }
while(1) { Think(d); Write(d); }
![Page 47: Petri Nets Copyright, 2003 © Jerzy R. Nawrocki Jerzy.Nawrocki@put.poznan.pl Models and Analysis of Software Lecture.](https://reader035.fdocuments.net/reader035/viewer/2022062718/56649ebf5503460f94bc9122/html5/thumbnails/47.jpg)
J. Nawrocki, Models & Analysis of Soft.
Readers and writersReaders and writersReaders and writersReaders and writers
while(1) { StartRead(); Read(d); StopRead(); Use(d); }
while(1) { Think(d); StartWrite(); Write(d); StopWrite(); }
![Page 48: Petri Nets Copyright, 2003 © Jerzy R. Nawrocki Jerzy.Nawrocki@put.poznan.pl Models and Analysis of Software Lecture.](https://reader035.fdocuments.net/reader035/viewer/2022062718/56649ebf5503460f94bc9122/html5/thumbnails/48.jpg)
J. Nawrocki, Models & Analysis of Soft.
Readers and writersReaders and writersReaders and writersReaders and writers
void StartRead() { ReadersIn++; }
void StartWrite() { WritersIn++; }
void StopRead() {ReadersIn--; }
void StopWrite() {WritersIn--; }
![Page 49: Petri Nets Copyright, 2003 © Jerzy R. Nawrocki Jerzy.Nawrocki@put.poznan.pl Models and Analysis of Software Lecture.](https://reader035.fdocuments.net/reader035/viewer/2022062718/56649ebf5503460f94bc9122/html5/thumbnails/49.jpg)
J. Nawrocki, Models & Analysis of Soft.
Readers and writersReaders and writersReaders and writersReaders and writers
void StartRead() { wait(Readers); ReadersIn++; }
void StartWrite() { wait(Writers); WritersIn++; }
void StopRead() {ReadersIn--; signal(Writers); }
void StopWrite() {WritersIn--; signal(Writers); signal(Readers); }
![Page 50: Petri Nets Copyright, 2003 © Jerzy R. Nawrocki Jerzy.Nawrocki@put.poznan.pl Models and Analysis of Software Lecture.](https://reader035.fdocuments.net/reader035/viewer/2022062718/56649ebf5503460f94bc9122/html5/thumbnails/50.jpg)
J. Nawrocki, Models & Analysis of Soft.
Readers and writersReaders and writersReaders and writersReaders and writers
void StartRead() {if(WritersIn > 0) wait(Readers); ReadersIn++; }
void StartWrite() {if(ReadersIn > 0 || WritersIn > 0) wait(Writers); WritersIn++; }
void StopRead() {ReadersIn--; if(ReadersIn == 0) signal(Writers); }
void StopWrite() {WritersIn--; if(!Empty(Writers)) signal(Writers); else if(!Empty(Readers)) signal(Readers); }
![Page 51: Petri Nets Copyright, 2003 © Jerzy R. Nawrocki Jerzy.Nawrocki@put.poznan.pl Models and Analysis of Software Lecture.](https://reader035.fdocuments.net/reader035/viewer/2022062718/56649ebf5503460f94bc9122/html5/thumbnails/51.jpg)
J. Nawrocki, Models & Analysis of Soft.
Readers and writersReaders and writersReaders and writersReaders and writers
StartRead
while(1) { StartRead(); Read(d); StopRead(); Use(d); }
while(1) { Think(d); StartWrite(); Write(d); StopWrite(); }
StopReadStopWrite
StartWrite
2
2
![Page 52: Petri Nets Copyright, 2003 © Jerzy R. Nawrocki Jerzy.Nawrocki@put.poznan.pl Models and Analysis of Software Lecture.](https://reader035.fdocuments.net/reader035/viewer/2022062718/56649ebf5503460f94bc9122/html5/thumbnails/52.jpg)
J. Nawrocki, Models & Analysis of Soft.
Readers and writersReaders and writersReaders and writersReaders and writers
StartRead
while(1) { StartRead(); Read(d); StopRead(); Use(d); }
while(1) { Think(d); StartWrite(); Write(d); StopWrite(); }
StopReadStopWrite
StartWrite
2
2
![Page 53: Petri Nets Copyright, 2003 © Jerzy R. Nawrocki Jerzy.Nawrocki@put.poznan.pl Models and Analysis of Software Lecture.](https://reader035.fdocuments.net/reader035/viewer/2022062718/56649ebf5503460f94bc9122/html5/thumbnails/53.jpg)
J. Nawrocki, Models & Analysis of Soft.
Readers and writersReaders and writersReaders and writersReaders and writers
StartRead
while(1) { StartRead(); Read(d); StopRead(); Use(d); }
while(1) { Think(d); StartWrite(); Write(d); StopWrite(); }
StopReadStopWrite
StartWrite
2
2
![Page 54: Petri Nets Copyright, 2003 © Jerzy R. Nawrocki Jerzy.Nawrocki@put.poznan.pl Models and Analysis of Software Lecture.](https://reader035.fdocuments.net/reader035/viewer/2022062718/56649ebf5503460f94bc9122/html5/thumbnails/54.jpg)
J. Nawrocki, Models & Analysis of Soft.
Readers and writersReaders and writersReaders and writersReaders and writers
StartRead
while(1) { StartRead(); Read(d); StopRead(); Use(d); }
while(1) { Think(d); StartWrite(); Write(d); StopWrite(); }
StopReadStopWrite
StartWrite
2
2
![Page 55: Petri Nets Copyright, 2003 © Jerzy R. Nawrocki Jerzy.Nawrocki@put.poznan.pl Models and Analysis of Software Lecture.](https://reader035.fdocuments.net/reader035/viewer/2022062718/56649ebf5503460f94bc9122/html5/thumbnails/55.jpg)
J. Nawrocki, Models & Analysis of Soft.
Readers and writersReaders and writersReaders and writersReaders and writers
StartRead
while(1) { StartRead(); Read(d); StopRead(); Use(d); }
while(1) { Think(d); StartWrite(); Write(d); StopWrite(); }
StopReadStopWrite
StartWrite
2
2
![Page 56: Petri Nets Copyright, 2003 © Jerzy R. Nawrocki Jerzy.Nawrocki@put.poznan.pl Models and Analysis of Software Lecture.](https://reader035.fdocuments.net/reader035/viewer/2022062718/56649ebf5503460f94bc9122/html5/thumbnails/56.jpg)
J. Nawrocki, Models & Analysis of Soft.
Readers and writersReaders and writersReaders and writersReaders and writers
StartRead
while(1) { StartRead(); Read(d); StopRead(); Use(d); }
while(1) { Think(d); StartWrite(); Write(d); StopWrite(); }
StopReadStopWrite
StartWrite
2
2
![Page 57: Petri Nets Copyright, 2003 © Jerzy R. Nawrocki Jerzy.Nawrocki@put.poznan.pl Models and Analysis of Software Lecture.](https://reader035.fdocuments.net/reader035/viewer/2022062718/56649ebf5503460f94bc9122/html5/thumbnails/57.jpg)
J. Nawrocki, Models & Analysis of Soft.
Readers and writersReaders and writersReaders and writersReaders and writers
StartRead
while(1) { StartRead(); Read(d); StopRead(); Use(d); }
while(1) { Think(d); StartWrite(); Write(d); StopWrite(); }
StopReadStopWrite
StartWrite
2
2
![Page 58: Petri Nets Copyright, 2003 © Jerzy R. Nawrocki Jerzy.Nawrocki@put.poznan.pl Models and Analysis of Software Lecture.](https://reader035.fdocuments.net/reader035/viewer/2022062718/56649ebf5503460f94bc9122/html5/thumbnails/58.jpg)
J. Nawrocki, Models & Analysis of Soft.
Readers and writersReaders and writersReaders and writersReaders and writers
StartRead
while(1) { StartRead(); Read(d); StopRead(); Use(d); }
while(1) { Think(d); StartWrite(); Write(d); StopWrite(); }
StopReadStopWrite
StartWrite
2
2
![Page 59: Petri Nets Copyright, 2003 © Jerzy R. Nawrocki Jerzy.Nawrocki@put.poznan.pl Models and Analysis of Software Lecture.](https://reader035.fdocuments.net/reader035/viewer/2022062718/56649ebf5503460f94bc9122/html5/thumbnails/59.jpg)
J. Nawrocki, Models & Analysis of Soft.
Readers and writersReaders and writersReaders and writersReaders and writers
StartRead
while(1) { StartRead(); Read(d); StopRead(); Use(d); }
while(1) { Think(d); StartWrite(); Write(d); StopWrite(); }
StopReadStopWrite
StartWrite
2
2
![Page 60: Petri Nets Copyright, 2003 © Jerzy R. Nawrocki Jerzy.Nawrocki@put.poznan.pl Models and Analysis of Software Lecture.](https://reader035.fdocuments.net/reader035/viewer/2022062718/56649ebf5503460f94bc9122/html5/thumbnails/60.jpg)
J. Nawrocki, Models & Analysis of Soft.
Readers and writersReaders and writersReaders and writersReaders and writers
StartRead
while(1) { StartRead(); Read(d); StopRead(); Use(d); }
while(1) { Think(d); StartWrite(); Write(d); StopWrite(); }
StopReadStopWrite
StartWrite
2
2
![Page 61: Petri Nets Copyright, 2003 © Jerzy R. Nawrocki Jerzy.Nawrocki@put.poznan.pl Models and Analysis of Software Lecture.](https://reader035.fdocuments.net/reader035/viewer/2022062718/56649ebf5503460f94bc9122/html5/thumbnails/61.jpg)
J. Nawrocki, Models & Analysis of Soft.
Readers and writersReaders and writersReaders and writersReaders and writers
StartRead
while(1) { StartRead(); Read(d); StopRead(); Use(d); }
while(1) { Think(d); StartWrite(); Write(d); StopWrite(); }
StopReadStopWrite
StartWrite
2
2
![Page 62: Petri Nets Copyright, 2003 © Jerzy R. Nawrocki Jerzy.Nawrocki@put.poznan.pl Models and Analysis of Software Lecture.](https://reader035.fdocuments.net/reader035/viewer/2022062718/56649ebf5503460f94bc9122/html5/thumbnails/62.jpg)
J. Nawrocki, Models & Analysis of Soft.
Readers and writersReaders and writersReaders and writersReaders and writers
StartRead
while(1) { StartRead(); Read(d); StopRead(); Use(d); }
while(1) { Think(d); StartWrite(); Write(d); StopWrite(); }
StopReadStopWrite
StartWrite
2
2
![Page 63: Petri Nets Copyright, 2003 © Jerzy R. Nawrocki Jerzy.Nawrocki@put.poznan.pl Models and Analysis of Software Lecture.](https://reader035.fdocuments.net/reader035/viewer/2022062718/56649ebf5503460f94bc9122/html5/thumbnails/63.jpg)
J. Nawrocki, Models & Analysis of Soft.
Readers and writersReaders and writersReaders and writersReaders and writers
StartRead
while(1) { StartRead(); Read(d); StopRead(); Use(d); }
while(1) { Think(d); StartWrite(); Write(d); StopWrite(); }
StopReadStopWrite
StartWrite
2
2
![Page 64: Petri Nets Copyright, 2003 © Jerzy R. Nawrocki Jerzy.Nawrocki@put.poznan.pl Models and Analysis of Software Lecture.](https://reader035.fdocuments.net/reader035/viewer/2022062718/56649ebf5503460f94bc9122/html5/thumbnails/64.jpg)
J. Nawrocki, Models & Analysis of Soft.
Plan of the lecturePlan of the lecturePlan of the lecturePlan of the lecture
• From the previous lecture..• Introduction• Simple examples• Concurrent transitions• Transitions in conflict• Another example• Readers and writers
• Properties of Petri Nets
![Page 65: Petri Nets Copyright, 2003 © Jerzy R. Nawrocki Jerzy.Nawrocki@put.poznan.pl Models and Analysis of Software Lecture.](https://reader035.fdocuments.net/reader035/viewer/2022062718/56649ebf5503460f94bc9122/html5/thumbnails/65.jpg)
J. Nawrocki, Models & Analysis of Soft.
Properties of Petri NetsProperties of Petri NetsProperties of Petri NetsProperties of Petri Nets
Reachability of a given marking
k-Boundedness:
A number of tokens in each place never exceeds k for any marking M reachable from the initial marking.
K-Boundedness
![Page 66: Petri Nets Copyright, 2003 © Jerzy R. Nawrocki Jerzy.Nawrocki@put.poznan.pl Models and Analysis of Software Lecture.](https://reader035.fdocuments.net/reader035/viewer/2022062718/56649ebf5503460f94bc9122/html5/thumbnails/66.jpg)
J. Nawrocki, Models & Analysis of Soft.
Properties of Petri NetsProperties of Petri NetsProperties of Petri NetsProperties of Petri Nets
A PN is live if for every marking M reachable from the initial marking M0 it is possible eventually to fire every transition in the net in some marking M’ which is reachable from M.
Liveness
![Page 67: Petri Nets Copyright, 2003 © Jerzy R. Nawrocki Jerzy.Nawrocki@put.poznan.pl Models and Analysis of Software Lecture.](https://reader035.fdocuments.net/reader035/viewer/2022062718/56649ebf5503460f94bc9122/html5/thumbnails/67.jpg)
J. Nawrocki, Models & Analysis of Soft.
Properties of Petri NetsProperties of Petri NetsProperties of Petri NetsProperties of Petri Nets
An infinite firing sequence s is said to be globally fair if every transition appears in s infinitely often.
Global fairness
![Page 68: Petri Nets Copyright, 2003 © Jerzy R. Nawrocki Jerzy.Nawrocki@put.poznan.pl Models and Analysis of Software Lecture.](https://reader035.fdocuments.net/reader035/viewer/2022062718/56649ebf5503460f94bc9122/html5/thumbnails/68.jpg)
J. Nawrocki, Models & Analysis of Soft.
SummarySummarySummarySummary
Petri nets: a simple modelling tool oriented towards concurrent and distributed systems.
Timed Petri Nets
Coloured Petri Nets
Stochastic Petri Nets
![Page 69: Petri Nets Copyright, 2003 © Jerzy R. Nawrocki Jerzy.Nawrocki@put.poznan.pl Models and Analysis of Software Lecture.](https://reader035.fdocuments.net/reader035/viewer/2022062718/56649ebf5503460f94bc9122/html5/thumbnails/69.jpg)
J. Nawrocki, Models & Analysis of Soft.
Further readingsFurther readingsFurther readingsFurther readings
James L. Peterson, Petri Nets,
Computing Surveys, vol. 9, No. 3, September 1977, 223 – 252.
N. Nissanke, Realtime Systems, Prentice Hall, London, 1997.
![Page 70: Petri Nets Copyright, 2003 © Jerzy R. Nawrocki Jerzy.Nawrocki@put.poznan.pl Models and Analysis of Software Lecture.](https://reader035.fdocuments.net/reader035/viewer/2022062718/56649ebf5503460f94bc9122/html5/thumbnails/70.jpg)
J. Nawrocki, Models & Analysis of Soft.
HomeworkHomeworkHomeworkHomework
Translate the statechart given below to Petri Nets.
B
C
(in G)
AE
F
G
D
![Page 71: Petri Nets Copyright, 2003 © Jerzy R. Nawrocki Jerzy.Nawrocki@put.poznan.pl Models and Analysis of Software Lecture.](https://reader035.fdocuments.net/reader035/viewer/2022062718/56649ebf5503460f94bc9122/html5/thumbnails/71.jpg)
J. Nawrocki, Models & Analysis of Soft.
HomeworkHomeworkHomeworkHomework
• Prepare a model of a file access control protocol allowing up to four concurrent readers in read-only mode or a single writer in exclusive read and write mode.
• Draw statechart counterparts of the presented Petri Nets.
![Page 72: Petri Nets Copyright, 2003 © Jerzy R. Nawrocki Jerzy.Nawrocki@put.poznan.pl Models and Analysis of Software Lecture.](https://reader035.fdocuments.net/reader035/viewer/2022062718/56649ebf5503460f94bc9122/html5/thumbnails/72.jpg)
J. Nawrocki, Models & Analysis of Soft.
Quality assessmentQuality assessmentQuality assessmentQuality assessment
1. What is your general impression? (1 - 6)
2. Was it too slow or too fast?
3. What important did you learn during the lecture?
4. What to improve and how?