29
Prof. Dr. R. H. Reussner ([email protected]) Lehrstuhl Software-Entwurf und  Qualität Institut für Programmstrukturen und Datenorganisation (IPD) Fakultät für Informatik, Universität Karlsruhe (TH) Universität Karlsruhe (TH) Forschungsunive rsität gegründet 1825 Praktikum Ing enieurmäßi ge Software-Entwicklung Palladio Component Model Part III (PCM)

3. PCM Parameter

Embed Size (px)

DESCRIPTION

PCM Tutorials

Citation preview

Page 1: 3. PCM Parameter

7/17/2019 3. PCM Parameter

http://slidepdf.com/reader/full/3-pcm-parameter 1/29

Prof. Dr. R. H. Reussner ([email protected])

Lehrstuhl Software-Entwurf und  –Qualität

Institut für Programmstrukturen und Datenorganisation (IPD)

Fakultät für Informatik, Universität Karlsruhe (TH)

Universität Karlsruhe (TH)Forschungsuniversität gegründet 1825

Praktikum IngenieurmäßigeSoftware-Entwicklung

Palladio Component Model – Part III (PCM)

Page 2: 3. PCM Parameter

7/17/2019 3. PCM Parameter

http://slidepdf.com/reader/full/3-pcm-parameter 2/29

 

X perf=1.00

Xloss=0.01

Software esign

  and Quality

Outline

1.Introductiona. Roles, Process Model, Example

b. Solver (Simulation, Analytical Model)

2.Component Developer

a. Repositoryb. Component, Interface, Data Types

c. SEFF

3.Stochastic Expressions

a. Constants, PMF, PDF, ParameterCharacterisation

b. Parametric Dependencies

Palladio Component Model 08.06.2007 2

Lecture 1

Lecture 2

Lecture 3

Page 3: 3. PCM Parameter

7/17/2019 3. PCM Parameter

http://slidepdf.com/reader/full/3-pcm-parameter 3/29

 

X perf=1.00

Xloss=0.01

Software esign

  and Quality

Uncertainties

▪ A situation is uncertainif the outcome is unknown in advance

▪ Probabilistic characterisations possible

▪ Examples– How will users interact with a system?

– When do they arrive?

– Which parameters do they pass in their calls?

Palladio Component Model 08.06.2007 3

Page 4: 3. PCM Parameter

7/17/2019 3. PCM Parameter

http://slidepdf.com/reader/full/3-pcm-parameter 4/29

 

X perf=1.00

Xloss=0.01

Software esign

  and Quality

Random Variables

▪ Random variables describe uncertain events▪ They may be described by their probability

distribution

▪ Two kinds of random variables:– Discrete

• Example: Iteration count of a loop

– Continuous

• Example: Passed time between the arrival of two jobs

Palladio Component Model 08.06.2007 4

Page 5: 3. PCM Parameter

7/17/2019 3. PCM Parameter

http://slidepdf.com/reader/full/3-pcm-parameter 5/29

 

X perf=1.00

Xloss=0.01

Software esign

  and Quality

Probability Mass Function

▪ PMF▪ Distribution Function of a discrete variable

▪ Domain type depends on the model– Loop Iterations: Integer

– Collection Structure: Enum– Actual Value: Any

– …

▪ PMF Literals

– IntPMF[(1;0.1)(2;0.3)(5;0.6)]– EnumPMF[(„Sorted“;0.5)(„Unsorted“;0.5)]

▪ Constraint: Sum of probabilities has to be 1,be careful, this is still unchecked in the tools!

Palladio Component Model 08.06.2007 5

Page 6: 3. PCM Parameter

7/17/2019 3. PCM Parameter

http://slidepdf.com/reader/full/3-pcm-parameter 6/29

 

X perf=1.00

Xloss=0.01

Software esign

  and Quality

Probability Mass Function

Palladio Component Model 08.06.2007 6

1 2 3

0.1

0.2

0.3

0.4

0.5

VALUE

Probability

IntPMF[(1;0.2)(2;0.3)(3;0.5)]

Page 7: 3. PCM Parameter

7/17/2019 3. PCM Parameter

http://slidepdf.com/reader/full/3-pcm-parameter 7/29

 

X perf=1.00

Xloss=0.01

Software esign

  and Quality

Probability Density Function

▪ PDF▪ Dist. Function of a continuous random variable

▪ Domain is always double

▪ Hard to characterise as possibly infinite

We use a derived discrete function: BoxedPDF

▪ Boxes sum up all eventsfalling into their bounds

▪ Inner box distribution is uniform▪ Depicted as histogram or CDF

Palladio Component Model 08.06.2007 7

Page 8: 3. PCM Parameter

7/17/2019 3. PCM Parameter

http://slidepdf.com/reader/full/3-pcm-parameter 8/29

 

X perf=1.00

Xloss=0.01

Software esign

  and Quality

PDF

Palladio Component Model 08.06.2007 8

Page 9: 3. PCM Parameter

7/17/2019 3. PCM Parameter

http://slidepdf.com/reader/full/3-pcm-parameter 9/29

 

X perf=1.00

Xloss=0.01

Software esign

  and Quality

Specification

Palladio Component Model 08.06.2007 9

1 320

0.4

0.6   DoublePDF[(1;0)(2;0.4)(3;0.6)]

Page 10: 3. PCM Parameter

7/17/2019 3. PCM Parameter

http://slidepdf.com/reader/full/3-pcm-parameter 10/29

 

X perf=1.00

Xloss=0.01

Software esign

  and Quality

Specification

Palladio Component Model 08.06.2007 10

1 320

0.4

0.6   DoublePDF[(1;0)(2;0.4)(3;0.6)]

Note:

As first value,implicitly (0,0)

is always assumed!

Page 11: 3. PCM Parameter

7/17/2019 3. PCM Parameter

http://slidepdf.com/reader/full/3-pcm-parameter 11/29

 

X perf=1.00

Xloss=0.01

Software esign

  and Quality

Specification

Palladio Component Model 08.06.2007 11

1 320

0.4

0.6   DoublePDF[(1;0)(2;0.4)(3;0.6)]

Page 12: 3. PCM Parameter

7/17/2019 3. PCM Parameter

http://slidepdf.com/reader/full/3-pcm-parameter 12/29

 

X perf=1.00

Xloss=0.01

Software esign

  and Quality

Specification

Palladio Component Model 08.06.2007 12

1 320

0.4

0.6   DoublePDF[(1;0)(2;0.4)(3;0.6)]

Page 13: 3. PCM Parameter

7/17/2019 3. PCM Parameter

http://slidepdf.com/reader/full/3-pcm-parameter 13/29

 

X perf=1.00

Xloss=0.01

Software esign

  and Quality

PDF

Palladio Component Model 08.06.2007 13

0.0

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1.0

0 1 2 3 4 5 6 7 8 9 10 11 12 13

   C  u

  m  u   l  a   t   i  v  e   P  r  o   b  a   b   i   l   i   t  y

Response Time (Seconds)

Prediction

Page 14: 3. PCM Parameter

7/17/2019 3. PCM Parameter

http://slidepdf.com/reader/full/3-pcm-parameter 14/29

 

X perf=1.00

Xloss=0.01

Software esign

  and Quality

Semantics

▪ X ~ DoublePDF[(1;0)(2;0.4)(3;0.6)]– P(0<=x<1) = 0

– P(1<=x<2) = 0.4

– P(2<=x<3) = 0.6

– P(1<=x<1.5) = 0.2

- …

- Y ~ IntPMF[(1;0.2)(2;0.5)(3;0.3)]

- P(Y = 1) = 0.2- P(Y = 2) = 0.5

- P(Y = 3) = 0.3

- P(Y = n) = 0 for all n >=4

Palladio Component Model 08.06.2007 14

Page 15: 3. PCM Parameter

7/17/2019 3. PCM Parameter

http://slidepdf.com/reader/full/3-pcm-parameter 15/29

 

X perf=1.00

Xloss=0.01

Software esign

  and Quality

Functional dependentrandom variables

▪ X ~ IntPMF▪ Y ~ IntPMF

▪ Z = X * Y

– Z is also a Random Variable

– Z ~ IntPMF

– Z‘s distribution is derived automatically

▪ Operators: +, -, *, /, ^, <, >, …

▪ Resulting grammar is called StochasticExpression (StoEx) in PCM

Palladio Component Model 08.06.2007 15

Page 16: 3. PCM Parameter

7/17/2019 3. PCM Parameter

http://slidepdf.com/reader/full/3-pcm-parameter 16/29

 

X perf=1.00

Xloss=0.01

Software esign

  and Quality

Using random variablesfor modelling

▪ Where can we use random variables?– Loop iterations

– Branch conditions

– Inter arrival time

– Think time

– For input parameter characterisations

– For output/return parameter characterisations

– For resource demands

Palladio Component Model 08.06.2007 16

Page 17: 3. PCM Parameter

7/17/2019 3. PCM Parameter

http://slidepdf.com/reader/full/3-pcm-parameter 17/29

 

X perf=1.00

Xloss=0.01

Software esign

  and Quality

Introducing variables…

▪ We can define our own variables to describeparameters

▪ They are set at the caller‘s side

▪ They are used at the called side

▪ Model performance relevant dependenciesonly!– Most parameters have no or only little influence

on the performance

– Omit these parameters from the specification!– Example: int ICalculator.add(int a, int b)

Performance is not depending significantly onany parameter value!

Palladio Component Model 08.06.2007 17

Page 18: 3. PCM Parameter

7/17/2019 3. PCM Parameter

http://slidepdf.com/reader/full/3-pcm-parameter 18/29

 

X perf=1.00

Xloss=0.01

Software esign

  and Quality

Parameter Abstractions

▪ We normally do not model parametervalues but performance abstractions

▪ The following types are available– BYTESIZE: Memory footprint of a parameter

– VALUE: The actual value of a parameter forprimitive types

– STRUCTURE: Structure of data, like „sorted“ or „unsorted“

– NUMBER_OF_ELEMENTS: The number ofelements in a collection

– TYPE: The actual type of a parameter (vs. thedeclared type)

Palladio Component Model 08.06.2007 18

Page 19: 3. PCM Parameter

7/17/2019 3. PCM Parameter

http://slidepdf.com/reader/full/3-pcm-parameter 19/29

 

X perf=1.00

Xloss=0.01

Software esign

  and Quality

Examples

Void aMethod(int a, int[] b, MyFigure c)

Caller Specifies:

a.BYTESIZE = 4a.VALUE =

IntPMF[(10;0.2)(30;0.4)(100;0.4)]

b.NUMBER_OF_ELEMENTS = 100

c.TYPE =EnumPMF[(„circle“;0.4)(„rectangle“;0.6)]

Palladio Component Model 08.06.2007 19

Page 20: 3. PCM Parameter

7/17/2019 3. PCM Parameter

http://slidepdf.com/reader/full/3-pcm-parameter 20/29

 

X perf=1.00

Xloss=0.01

Software esign

  and Quality

Example cont.

Void aMethod(int a, int[] b, MyFigure c)

Use in the SEFF of aMethod 

aLoop.Iterations = a.VALUEanAction.ResourceDemand =

b.NUMBER_OF_ELEMENTS * 100

aBranch.Condition = c.TYPE == „circle“

Palladio Component Model 08.06.2007 20

Page 21: 3. PCM Parameter

7/17/2019 3. PCM Parameter

http://slidepdf.com/reader/full/3-pcm-parameter 21/29

 

X perf=1.00

Xloss=0.01

Software esign

  and Quality

Special Keywords

▪ INNER– Refers to the elements of a collection

– Describes the contents of the collection

▪ RETURN

– Refers to the return value of the current SEFF

– Characterises the result

▪ Namespace of variables

– Characterise inner elements of composed datatypes

Palladio Component Model 08.06.2007 21

Page 22: 3. PCM Parameter

7/17/2019 3. PCM Parameter

http://slidepdf.com/reader/full/3-pcm-parameter 22/29

 

X perf=1.00

Xloss=0.01

Software esign

  and Quality

Examples

Void aMethod(int a, int[] b, MyFigure c)

b.INNER.BYTESIZE = 4

b.INNER.VALUE = 42b.INNER.VALUE = IntPMF[(42;0.5)(43;0.5)]

c.color.VALUE =EnumPMF[(„red“;0.1)(„green“;0.9)]

Palladio Component Model 08.06.2007 22

Page 23: 3. PCM Parameter

7/17/2019 3. PCM Parameter

http://slidepdf.com/reader/full/3-pcm-parameter 23/29

 

X perf=1.00

Xloss=0.01

Software esign

  and Quality

Editor Support

▪ „StoEx-Dialog“▪ Offers syntax highlighting, code completion,

online help and basic syntax checking

▪ Often available on double click of thecorresponding model element

Palladio Component Model 08.06.2007 23

Page 24: 3. PCM Parameter

7/17/2019 3. PCM Parameter

http://slidepdf.com/reader/full/3-pcm-parameter 24/29

 

X perf=1.00

Xloss=0.01

Software esign

  and Quality

Semantic differenceLoop and Collection Iterator

▪ In a Loop all characterisations areevaluated any time they occur (stochasticalindependence)

// a.INNER.BYTESIZE=IntPMF[(1;0.5)(10;0.5)]

Object[] a = ...

for (int i=0; i < 10; i++) {

// a.INNER.BYTESIZE can be 1 in doSth

doSth(a[i]);

// a.INNER.BYTESIZE can be 10 in doSthElse

doSthElse(a[i]);

}

Palladio Component Model 08.06.2007 24

Page 25: 3. PCM Parameter

7/17/2019 3. PCM Parameter

http://slidepdf.com/reader/full/3-pcm-parameter 25/29

 

X perf=1.00

Xloss=0.01

Software esign

  and Quality

Semantic differenceLoop and Collection Iterator

▪ In a Collection Iterator all characterisations areevaluated any time they occur (stochasticalindependence) execpt the INNER characterisationsof the iterator parameter

// a.INNER.BYTESIZE=IntPMF[(1;0.5)(10;0.5)]

Object[] a = ...for (Object o:a) {

// a.INNER.BYTESIZE can be 1 in doSth

doSth(o);

// a.INNER.BYTESIZE is also 1 in doSthElsedoSthElse(o);

}

Palladio Component Model 08.06.2007 25

Page 26: 3. PCM Parameter

7/17/2019 3. PCM Parameter

http://slidepdf.com/reader/full/3-pcm-parameter 26/29

 

X perf=1.00

Xloss=0.01

Software esign

  and Quality

Semantics:Dependant Branches

// x.VALUE=IntPMF[(1;0.5)(6;0.3)(12;0.2)]if (x > 5) {

if (x > 10) {

} else {

}

}

If you would have to model this withprobabilistic branch transitions, what wouldbe the probabilities? (Tip: Bayes Theorem!!!)

Palladio Component Model 08.06.2007 26

Page 27: 3. PCM Parameter

7/17/2019 3. PCM Parameter

http://slidepdf.com/reader/full/3-pcm-parameter 27/29

 

X perf=1.00

Xloss=0.01

Software esign

  and Quality

Semantics:Dependant Branches

// x.VALUE=IntPMF[(1;0.5)(6;0.3)(12;0.2)]

if (x > 5) { // p = 0.5

// x.VALUE is always 6 or 12 here!if (x > 10) { // p = 0.4

// x.VALUE is always 12 here!

} else { // p = 0.6// x.VALUE is always 6 here!

}

} else { // p = 0.5// x.VALUE is always 1 here!

}

Our tools respect this automatically, you don’thave to calculate on your own!

Palladio Component Model 08.06.2007 27

Page 28: 3. PCM Parameter

7/17/2019 3. PCM Parameter

http://slidepdf.com/reader/full/3-pcm-parameter 28/29

 

X perf=1.00

Xloss=0.01

Software esign

  and Quality

Now: Exercises in the Tool

▪ Switch to Eclipse!

Palladio Component Model 08.06.2007 28

Page 29: 3. PCM Parameter

7/17/2019 3. PCM Parameter

http://slidepdf.com/reader/full/3-pcm-parameter 29/29

 

X perf=1.00

Xloss=0.01

Software esign

  and Quality

Lessons Learned Today

▪ What is uncertainty?▪ How is it modelled in PCM?

▪ Random Variables

▪ Random Variables in the PCM– Loop Iterations

– Branch Conditions

– Resource Demands

– Parameter characterisations– Usage model details