Top Banner
Course : Software Engineering II academic year: 2007-2008 Course Web-site: [www.di.univaq.it/ cortelle / ] Lecturer : Catia Trubiani Computer Science Department University of L'Aquila - Italy [email protected] Lecture 21: Performance Modeling with GSPNs
31

Course: Software Engineering II academic year: 2007-2008 Course Web-site: [ Lecturer: Catia Trubiani.

Dec 14, 2015

Download

Documents

Priscila Taft
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Course: Software Engineering II academic year: 2007-2008 Course Web-site: [ Lecturer: Catia Trubiani.

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

[email protected]

Lecture 21: Performance Modeling with GSPNs

Page 2: Course: Software Engineering II academic year: 2007-2008 Course Web-site: [ Lecturer: Catia Trubiani.

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.

Page 3: Course: Software Engineering II academic year: 2007-2008 Course Web-site: [ Lecturer: Catia Trubiani.

3

SEA GroupSEA Group

Roadmap

Performance

modeling

evaluationGeneralized

Stochastic Petri Nets (GSPNs)

Symbolic Hierarchical Automated Reliability and

Performance Evaluator (SHARPE)

Page 4: Course: Software Engineering II academic year: 2007-2008 Course Web-site: [ Lecturer: Catia Trubiani.

4

SEA GroupSEA Group

Software Performance

Software developers’ world (vocabulary) is intrinsically distant from performance analysts’ one.

APPLICATIONMODEL

APPLICATIONPERFORMANCE

MODEL

APPLICATIONPERFORMANCE

MODEL

Page 5: Course: Software Engineering II academic year: 2007-2008 Course Web-site: [ Lecturer: Catia Trubiani.

5

SEA GroupSEA Group

Performance Notations

Markov process

es

Queueing

Networks

Generalized

Stochastic Petri Nets Stochast

ic Process Algebras

Simulation

Page 6: Course: Software Engineering II academic year: 2007-2008 Course Web-site: [ Lecturer: Catia Trubiani.

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

Page 7: Course: Software Engineering II academic year: 2007-2008 Course Web-site: [ Lecturer: Catia Trubiani.

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

Page 8: Course: Software Engineering II academic year: 2007-2008 Course Web-site: [ Lecturer: Catia Trubiani.

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

Page 9: Course: Software Engineering II academic year: 2007-2008 Course Web-site: [ Lecturer: Catia Trubiani.

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

Page 10: Course: Software Engineering II academic year: 2007-2008 Course Web-site: [ Lecturer: Catia Trubiani.

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

Page 11: Course: Software Engineering II academic year: 2007-2008 Course Web-site: [ Lecturer: Catia Trubiani.

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

Page 12: Course: Software Engineering II academic year: 2007-2008 Course Web-site: [ Lecturer: Catia Trubiani.

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)

Page 13: Course: Software Engineering II academic year: 2007-2008 Course Web-site: [ Lecturer: Catia Trubiani.

13

SEA GroupSEA Group

Example – Banking System

Use Case Diagram

Central Server

ATM1

ATM2 ATMn

………

Page 14: Course: Software Engineering II academic year: 2007-2008 Course Web-site: [ Lecturer: Catia Trubiani.

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

Page 15: Course: Software Engineering II academic year: 2007-2008 Course Web-site: [ Lecturer: Catia Trubiani.

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

Page 16: Course: Software Engineering II academic year: 2007-2008 Course Web-site: [ Lecturer: Catia Trubiani.

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

Page 17: Course: Software Engineering II academic year: 2007-2008 Course Web-site: [ Lecturer: Catia Trubiani.

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

Page 18: Course: Software Engineering II academic year: 2007-2008 Course Web-site: [ Lecturer: Catia Trubiani.

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

Page 19: Course: Software Engineering II academic year: 2007-2008 Course Web-site: [ Lecturer: Catia Trubiani.

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.

Page 20: Course: Software Engineering II academic year: 2007-2008 Course Web-site: [ Lecturer: Catia Trubiani.

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…

Page 21: Course: Software Engineering II academic year: 2007-2008 Course Web-site: [ Lecturer: Catia Trubiani.

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

Page 22: Course: Software Engineering II academic year: 2007-2008 Course Web-site: [ Lecturer: Catia Trubiani.

22

SEA GroupSEA Group

Exercise – Elevator System

1st elevator 2nd elevator

And the users?

users1stFloor

users2ndFloor

users3rdFloor

Relationship between users and elevators?

Page 23: Course: Software Engineering II academic year: 2007-2008 Course Web-site: [ Lecturer: Catia Trubiani.

23

SEA GroupSEA Group

Exercise – Computation

» Computation

a calculator has two

variables, a and b;

- the calculation is the following (a+b)/(a-b)

Page 24: Course: Software Engineering II academic year: 2007-2008 Course Web-site: [ Lecturer: Catia Trubiani.

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)

Page 25: Course: Software Engineering II academic year: 2007-2008 Course Web-site: [ Lecturer: Catia Trubiani.

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.

Page 26: Course: Software Engineering II academic year: 2007-2008 Course Web-site: [ Lecturer: Catia Trubiani.

26

SEA GroupSEA Group

Exercise – Coffee machine

insert5cent

0cent

5cent 15cent

20cent10cent

insert10centinsert5cent

insert10cent

insert10cent

insert5cent

insert5cent

take15centProduct

take20centProduct

Page 27: Course: Software Engineering II academic year: 2007-2008 Course Web-site: [ Lecturer: Catia Trubiani.

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.

Page 28: Course: Software Engineering II academic year: 2007-2008 Course Web-site: [ Lecturer: Catia Trubiani.

28

SEA GroupSEA Group

Exercise – Communication

readyto send

waitfor ack

ackreceived

msgreceived

acksent

readyto receive

bufferfull

bufferfullsend

msg

receiveack

receivemsg

sendack

proc1

proc2

Page 29: Course: Software Engineering II academic year: 2007-2008 Course Web-site: [ Lecturer: Catia Trubiani.

29

SEA GroupSEA Group

Exercise – Dining Philosophers

» Five philosophers alternatively think and eating

five chopsticks

two states: philosophers eating, philosophers thinking

Page 30: Course: Software Engineering II academic year: 2007-2008 Course Web-site: [ Lecturer: Catia Trubiani.

30

SEA GroupSEA Group

Exercise – Dining Philosophers

Page 31: Course: Software Engineering II academic year: 2007-2008 Course Web-site: [ Lecturer: Catia Trubiani.

31

SEA GroupSEA Group

Basic Readings

» [Performance modeling]

M. Ajmone Marsan, Gianfranco Balbo, Gianni Conte, Susanna Donatelli, Giuliana Franceschinis “MODELLING WITH GENERALISED STOCHASTIC PETRI NETS”,