course: software engineering ii academic year: 2007-2008 course web-site: [ lecturer: catia trubiani
TRANSCRIPT
Course:
Software Engineering II
academic year: 2007-2008Course Web-site: [www.di.univaq.it/
cortelle/]
Lecturer: Catia Trubiani
Computer Science Department University of L'Aquila - Italy
Lecture 21: Performance Modeling with GSPNs
2
SEA GroupSEA Group
Copyright Notice
» The material in these slides may be freely reproduced and distributed, partially or totally, as far as an explicit reference or acknowledge to the material author is preserved.
3
SEA GroupSEA Group
Roadmap
Performance
modeling
evaluationGeneralized
Stochastic Petri Nets (GSPNs)
Symbolic Hierarchical Automated Reliability and
Performance Evaluator (SHARPE)
4
SEA GroupSEA Group
Software Performance
Software developers’ world (vocabulary) is intrinsically distant from performance analysts’ one.
APPLICATIONMODEL
APPLICATIONPERFORMANCE
MODEL
APPLICATIONPERFORMANCE
MODEL
5
SEA GroupSEA Group
Performance Notations
Markov process
es
Queueing
Networks
Generalized
Stochastic Petri Nets Stochast
ic Process Algebras
Simulation
6
SEA GroupSEA Group
Performance Model Elements : GSPNs
ARC WEIGHTS
Graphical Notation
PLACES
MARKING
X
Px
FLOW
RELATION
TRANSITIONS
Symbols Description
The number of tokens in places defines the marking of the net at a certain time
Arc weights are numbers associated to arcs
The arcs are input, output, or inhibitor and represent the link between places and transitions
Transitions are immediate or timed and represent the system changing state
Places are locations that represent (possibly partial) states of a system
timm ttimed
7
SEA GroupSEA Group
GSPNs formal definition
23
1
S = ( P , T , I , O , H , M0 )
P1
PLACES INITIAL
MARKING
INPUTTRANSITIONS
(immediate
P2
P3
2
P4
4
t1 t2
or timed)
OUTPUT
INHIBITION
2
PN system
8
SEA GroupSEA Group
GSPNs incrementally
22
1
P1
P2
P3
t12
2
1
P1
P2
P3
t1
22
1
P1
P2
P3
t1
2
t2
3
Petri Net
Stochastic Petri Net
Generalized Stochastic Petri Net
P4
9
SEA GroupSEA Group
GSPNs more formal
P is set of placesT is set of transitions, T ∩ P = Ø
I, O, H : T -> Bag(P) with Bag(P) multiset on P
Mo : P ->
t = { p E I (t,p) > 0 } input arcs t = { p E O (t,p) > 0 } output arcs °t = { p E H (t,p) > 0 } inhibitor arcs
S = ( P , T , I , O , H , M0 ) PN system
10
SEA GroupSEA Group
GSPNs formal example
I : t1 -> P1, t1 -> P2, t2 -> P3
O : t1 -> P3, t2 -> P4
H : t2 -> P4
23
1
P1
P2
P32 P4
4
t1 t2 2
t1 = { P1, P2 } t1 = { P3 } °t1 = Ø t2 = { P3 } t2 = { P4 } °t2 = { P4 }
P = { P1, P2, P3, P4 }T = { t1, t2 }
Mo: P1 ->3, P2 ->2, P3 ->1, P4 ->0
11
SEA GroupSEA Group
GSPNs formal example
I : t1 -> P1, t1 -> P2, t2 -> P3
I(t1 -> P1) = 2, I(t1 -> P2 ) = 1, t2 -> P3 = 4
O : t1 -> P3, t2 -> P4
O(t1 -> P3) = 3, O(t2 -> P4 ) = 2
H : t2 -> P4
H(t2 -> P4) = 2
23
1
P1
P2
P32 P4
4
t1 t2 2
12
SEA GroupSEA Group
GSPNs dynamics
Rules:
22
1
P1
P2
P3
22
1
P3P1
P2
t1
t1
(1) Enabling rule - conditions under which transitions are allowed to fire.
p E t, M(p) ≥ O (t, p) p E °t, M(p) < H (t, p)
(2) Firing rule – marking modifications induced by the transition firing.
M’ = M + O(t) – I(t)
14
SEA GroupSEA Group
Banking System Performance Model
Banking System (BS):
allow_request
usersarrivals
startWF
reqPD
answerWF
send_answerWF
startreqPIN
PIN_ko
PIN_ok
checkWF_ko
checkWF_ok
waitWF
rcvACK_WF
startQA
reqQA
answerQA
send_answerQA
checkQA_ko checkQA_ok
waitQA
rcvACK_QA
checkTF_ok
startTF
reqTF
answerTF
waitTF
checkTF_ko
validUser
rcvACK_TF
send_answerTF
-> WF: Withdraw Funds
-> QA: Query Account
-> TF: Transfer Funds
15
SEA GroupSEA Group
PN in execution – At Restaurant(1)
» Restaurant: First scenario
- waiter takes order
from customer 1
- tell kitchen
- serves customer 1
- waiter takes order
from customer 2
- tell kitchen
- serves customer 2
16
SEA GroupSEA Group
PN in execution – At Restaurant(1)
WaiterfreeCustomer 1 Customer 2
Takeorder
Takeorder
Ordertaken
Tellkitchen
wait wait
Serve food Serve food
eating eating
17
SEA GroupSEA Group
PN in execution – At Restaurant(2)
» Restaurant: Second scenario
- waiter takes order
from customer 1
- tell kitchen
- waiter takes order
from customer 2
- tell kitchen
- serves customer 1
- serves customer 2
18
SEA GroupSEA Group
PN in execution – At Restaurant(2)
WaiterfreeCustomer 1 Customer 2
Takeorder
Takeorder
Ordertaken
Tellkitchen
wait wait
Serve food Serve food
eating eating
19
SEA GroupSEA Group
Exercise – Elevator System
» Elevator System
an hotel has two
elevators;
there are three floors
to cover;
in every floor there are
0..n users waiting for
the elevator.
20
SEA GroupSEA Group
Exercise – Elevator System
1st elevator
1st floor
2nd floor
3rd floor
upTo2ndFloor
upTo3rdFloor
downTo1stFloor
downTo2ndFloor
first
second
third
Where is the elevator? What is the initial state?1st floor…
2nd floor…
3rd floor…
21
SEA GroupSEA Group
Exercise – Elevator System
1st elevator
1st floor
2nd floor
3rd floor
2nd elevator
1st floor
2nd floor
3rd floor
What is the initial state?Example: 1st elevator at 2nd floor, 2nd elevator at 1st
floor
CONCURRENTSYSTEMS
22
SEA GroupSEA Group
Exercise – Elevator System
1st elevator 2nd elevator
And the users?
users1stFloor
users2ndFloor
users3rdFloor
Relationship between users and elevators?
23
SEA GroupSEA Group
Exercise – Computation
» Computation
a calculator has two
variables, a and b;
- the calculation is the following (a+b)/(a-b)
24
SEA GroupSEA Group
Exercise – Computation
copy_a
x = (a+b)/(a-b)
copy_b
(a+b)
(a-b)
+
-
=!0
=0
/ x
ND
(a-b)
25
SEA GroupSEA Group
Exercise – Coffee machine
» Coffee machine
a coffee machine
accepts 5cent or 10cent;
- the cost of products
are 15cent or 20cent;
- no change.
26
SEA GroupSEA Group
Exercise – Coffee machine
insert5cent
0cent
5cent 15cent
20cent10cent
insert10centinsert5cent
insert10cent
insert10cent
insert5cent
insert5cent
take15centProduct
take20centProduct
27
SEA GroupSEA Group
Exercise – Communication
» Communication
- there are two processes
able to communicate ;
- one process sends messages,
the other process receives;
- the buffer accumulates one message at once.
28
SEA GroupSEA Group
Exercise – Communication
readyto send
waitfor ack
ackreceived
msgreceived
acksent
readyto receive
bufferfull
bufferfullsend
msg
receiveack
receivemsg
sendack
proc1
proc2
29
SEA GroupSEA Group
Exercise – Dining Philosophers
» Five philosophers alternatively think and eating
five chopsticks
two states: philosophers eating, philosophers thinking