architectures: design patterns for component-based … · joint work with: paul attie, eduard...

33
Architectures: Design Patterns for Component-Based Systems Short talk @ TGC, 5 th of September, 2014 Simon Bliudze École polytechnique fédérale de Lausanne Joint work with: Paul Attie, Eduard Baranov, Marius Bozga, Mohamad Jaber and Joseph Sifakis

Upload: tranminh

Post on 09-Aug-2018

214 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Architectures: Design Patterns for Component-Based … · Joint work with: Paul Attie, Eduard Baranov, Marius Bozga, Mohamad Jaber and Joseph Sifakis. S.Bliudze @ TGC, Rome, 5th of

Architectures: Design Patterns for Component-Based Systems

Short talk @ TGC, 5th of September, 2014

Simon BliudzeÉcole polytechnique fédérale de Lausanne

Joint work with: Paul Attie, Eduard Baranov, Marius Bozga, Mohamad Jaber and Joseph Sifakis

Page 2: Architectures: Design Patterns for Component-Based … · Joint work with: Paul Attie, Eduard Baranov, Marius Bozga, Mohamad Jaber and Joseph Sifakis. S.Bliudze @ TGC, Rome, 5th of

S.Bliudze @ TGC, Rome, 5th of September, 2014 / 17

Reusable design patterns• Systems are not built from

scratch

• Maximal re-use of building blocks (off-the-shelf components)

• Maximal re-use of solutions(libraries, design patterns, etc.)

• Express coordination constraints in declarative manner

2

Page 3: Architectures: Design Patterns for Component-Based … · Joint work with: Paul Attie, Eduard Baranov, Marius Bozga, Mohamad Jaber and Joseph Sifakis. S.Bliudze @ TGC, Rome, 5th of

S.Bliudze @ TGC, Rome, 5th of September, 2014 / 17

Applications• Concurrency:

(a)synchronous, time-triggered, token-ring, mutual exclusion

• Protocols:communication protocols, data access control, encryption, authentication

• Robustness:fault detection & recovery, resource management

• etc.

3

Page 4: Architectures: Design Patterns for Component-Based … · Joint work with: Paul Attie, Eduard Baranov, Marius Bozga, Mohamad Jaber and Joseph Sifakis. S.Bliudze @ TGC, Rome, 5th of

S.Bliudze @ TGC, Rome, 5th of September, 2014 / 17

Theory of architectures• How to model?

• How to specify?

• How to combine?

• How to implement efficiently?

4

Architectures enforce characteristic properties. The crucial question is whether these are preserved by composition?

Page 5: Architectures: Design Patterns for Component-Based … · Joint work with: Paul Attie, Eduard Baranov, Marius Bozga, Mohamad Jaber and Joseph Sifakis. S.Bliudze @ TGC, Rome, 5th of

How to model?

Page 6: Architectures: Design Patterns for Component-Based … · Joint work with: Paul Attie, Eduard Baranov, Marius Bozga, Mohamad Jaber and Joseph Sifakis. S.Bliudze @ TGC, Rome, 5th of

S.Bliudze @ TGC, Rome, 5th of September, 2014 / 17

Component-based design

• Three layers • Component behaviour • Coordination • Data transfer

6

Component design by refinement

Three layers:

1 Componentbehaviour

2 Coordination

3 Data transfer

SC 2011 — S. Bliudze, J. Sifakis, “Synthesizing Glue Operators...” — Zurich, June 30th , 2011 — 8 / 29

Component design by refinement

Three layers:

1 Componentbehaviour

2 Coordination

3 Data transfer

A

b1 r1

p1

f1

Bf2

b2

C

p3 f3

r3

b3

SC 2011 — S. Bliudze, J. Sifakis, “Synthesizing Glue Operators...” — Zurich, June 30th , 2011 — 9 / 29

Component design by refinement

Three layers:

1 Componentbehaviour

2 Coordination

3 Data transfer

A

b1 r1

p1

f1

Bf2

b2

C

p3 f3

r3

b3

SC 2011 — S. Bliudze, J. Sifakis, “Synthesizing Glue Operators...” — Zurich, June 30th , 2011 — 9 / 29

Component design by refinement

Three layers:

1 Componentbehaviour

2 Coordination

3 Data transfer

A

b1 r1

p1

f1

Bf2

b2

C

p3 f3

r3

b3

SC 2011 — S. Bliudze, J. Sifakis, “Synthesizing Glue Operators...” — Zurich, June 30th , 2011 — 9 / 29

A.x = max (B.y, C.z)

Page 7: Architectures: Design Patterns for Component-Based … · Joint work with: Paul Attie, Eduard Baranov, Marius Bozga, Mohamad Jaber and Joseph Sifakis. S.Bliudze @ TGC, Rome, 5th of

S.Bliudze @ TGC, Rome, 5th of September, 2014 / 17

Example in BIP

7

sleep

work

b1f1

b1 f1sleep

work

b2f2

b2 f2

Page 8: Architectures: Design Patterns for Component-Based … · Joint work with: Paul Attie, Eduard Baranov, Marius Bozga, Mohamad Jaber and Joseph Sifakis. S.Bliudze @ TGC, Rome, 5th of

S.Bliudze @ TGC, Rome, 5th of September, 2014 / 17

Example in BIP

7

sleep

work

b1f1

b1 f1sleep

work

b2f2

b2 f2free

taken

b12f12

b12 f12

Page 9: Architectures: Design Patterns for Component-Based … · Joint work with: Paul Attie, Eduard Baranov, Marius Bozga, Mohamad Jaber and Joseph Sifakis. S.Bliudze @ TGC, Rome, 5th of

S.Bliudze @ TGC, Rome, 5th of September, 2014 / 17

Example in BIP

7

sleep

work

b1f1

b1 f1sleep

work

b2f2

b2 f2free

taken

b12f12

b12 f12

Page 10: Architectures: Design Patterns for Component-Based … · Joint work with: Paul Attie, Eduard Baranov, Marius Bozga, Mohamad Jaber and Joseph Sifakis. S.Bliudze @ TGC, Rome, 5th of

S.Bliudze @ TGC, Rome, 5th of September, 2014 / 17

Example in BIP

7

b1 f1 b2 f2free

taken

b12f12

b12 f12

Page 11: Architectures: Design Patterns for Component-Based … · Joint work with: Paul Attie, Eduard Baranov, Marius Bozga, Mohamad Jaber and Joseph Sifakis. S.Bliudze @ TGC, Rome, 5th of

S.Bliudze @ TGC, Rome, 5th of September, 2014 / 17

Example in BIP

7

�12 = {;, b1b12, b2b12, f1f12, f2f12}

b1 f1 b2 f2free

taken

b12f12

b12 f12

Page 12: Architectures: Design Patterns for Component-Based … · Joint work with: Paul Attie, Eduard Baranov, Marius Bozga, Mohamad Jaber and Joseph Sifakis. S.Bliudze @ TGC, Rome, 5th of

S.Bliudze @ TGC, Rome, 5th of September, 2014 / 17

Architectures in BIP

8

A = (C, PA, �)

b1 f1 b2 f2free

taken

b12f12

b12 f12

Set of coordinating behaviours

Interface (ports)

Interaction model

[

C2CPC ✓ PA

The interface includes all ports of the coordinator components

Page 13: Architectures: Design Patterns for Component-Based … · Joint work with: Paul Attie, Eduard Baranov, Marius Bozga, Mohamad Jaber and Joseph Sifakis. S.Bliudze @ TGC, Rome, 5th of

How to combine?

Page 14: Architectures: Design Patterns for Component-Based … · Joint work with: Paul Attie, Eduard Baranov, Marius Bozga, Mohamad Jaber and Joseph Sifakis. S.Bliudze @ TGC, Rome, 5th of

S.Bliudze @ TGC, Rome, 5th of September, 2014 / 17

Constraints intuition

10

Page 15: Architectures: Design Patterns for Component-Based … · Joint work with: Paul Attie, Eduard Baranov, Marius Bozga, Mohamad Jaber and Joseph Sifakis. S.Bliudze @ TGC, Rome, 5th of

S.Bliudze @ TGC, Rome, 5th of September, 2014 / 17

Constraints intuition

10

Bad 1

Page 16: Architectures: Design Patterns for Component-Based … · Joint work with: Paul Attie, Eduard Baranov, Marius Bozga, Mohamad Jaber and Joseph Sifakis. S.Bliudze @ TGC, Rome, 5th of

S.Bliudze @ TGC, Rome, 5th of September, 2014 / 17

Constraints intuition

10

Bad 1

Page 17: Architectures: Design Patterns for Component-Based … · Joint work with: Paul Attie, Eduard Baranov, Marius Bozga, Mohamad Jaber and Joseph Sifakis. S.Bliudze @ TGC, Rome, 5th of

S.Bliudze @ TGC, Rome, 5th of September, 2014 / 17

Constraints intuition

10

Bad 1

Bad 2

Page 18: Architectures: Design Patterns for Component-Based … · Joint work with: Paul Attie, Eduard Baranov, Marius Bozga, Mohamad Jaber and Joseph Sifakis. S.Bliudze @ TGC, Rome, 5th of

S.Bliudze @ TGC, Rome, 5th of September, 2014 / 17

Constraints intuition

10

Bad 1

Bad 2

Page 19: Architectures: Design Patterns for Component-Based … · Joint work with: Paul Attie, Eduard Baranov, Marius Bozga, Mohamad Jaber and Joseph Sifakis. S.Bliudze @ TGC, Rome, 5th of

S.Bliudze @ TGC, Rome, 5th of September, 2014 / 17

Constraints intuition

10

Bad 1

Bad 2

Good

Page 20: Architectures: Design Patterns for Component-Based … · Joint work with: Paul Attie, Eduard Baranov, Marius Bozga, Mohamad Jaber and Joseph Sifakis. S.Bliudze @ TGC, Rome, 5th of

S.Bliudze @ TGC, Rome, 5th of September, 2014 / 17

Limits of white magic

11

Page 21: Architectures: Design Patterns for Component-Based … · Joint work with: Paul Attie, Eduard Baranov, Marius Bozga, Mohamad Jaber and Joseph Sifakis. S.Bliudze @ TGC, Rome, 5th of

S.Bliudze @ TGC, Rome, 5th of September, 2014 / 17

Limits of white magic

11

Bad 1

Page 22: Architectures: Design Patterns for Component-Based … · Joint work with: Paul Attie, Eduard Baranov, Marius Bozga, Mohamad Jaber and Joseph Sifakis. S.Bliudze @ TGC, Rome, 5th of

S.Bliudze @ TGC, Rome, 5th of September, 2014 / 17

Limits of white magic

11

Bad 1

Page 23: Architectures: Design Patterns for Component-Based … · Joint work with: Paul Attie, Eduard Baranov, Marius Bozga, Mohamad Jaber and Joseph Sifakis. S.Bliudze @ TGC, Rome, 5th of

S.Bliudze @ TGC, Rome, 5th of September, 2014 / 17

Limits of white magic

11

Bad 1Bad 2

Page 24: Architectures: Design Patterns for Component-Based … · Joint work with: Paul Attie, Eduard Baranov, Marius Bozga, Mohamad Jaber and Joseph Sifakis. S.Bliudze @ TGC, Rome, 5th of

S.Bliudze @ TGC, Rome, 5th of September, 2014 / 17

Limits of white magic

11

Bad 1Bad 2

Page 25: Architectures: Design Patterns for Component-Based … · Joint work with: Paul Attie, Eduard Baranov, Marius Bozga, Mohamad Jaber and Joseph Sifakis. S.Bliudze @ TGC, Rome, 5th of

S.Bliudze @ TGC, Rome, 5th of September, 2014 / 17

Limits of white magic

11

Bad 1Bad 2

Page 26: Architectures: Design Patterns for Component-Based … · Joint work with: Paul Attie, Eduard Baranov, Marius Bozga, Mohamad Jaber and Joseph Sifakis. S.Bliudze @ TGC, Rome, 5th of

How to implement efficiently?

Page 27: Architectures: Design Patterns for Component-Based … · Joint work with: Paul Attie, Eduard Baranov, Marius Bozga, Mohamad Jaber and Joseph Sifakis. S.Bliudze @ TGC, Rome, 5th of

S.Bliudze @ TGC, Rome, 5th of September, 2014 / 17

Architecture-basedExternal: component behaviour is not modified

13

baa

bdc

c

d

Page 28: Architectures: Design Patterns for Component-Based … · Joint work with: Paul Attie, Eduard Baranov, Marius Bozga, Mohamad Jaber and Joseph Sifakis. S.Bliudze @ TGC, Rome, 5th of

S.Bliudze @ TGC, Rome, 5th of September, 2014 / 17

Architecture-agnosticInternal: the coordination primitives mix-up with the

functional behaviour of the components

14

Task 1:!while (true) { free(S1); take(S2); do-a; free(S1); take(S2); do-b; }

Task 2:!while (true) { take(S1); free(S2); do-c; take(S1); free(S2); do-d; }

Page 29: Architectures: Design Patterns for Component-Based … · Joint work with: Paul Attie, Eduard Baranov, Marius Bozga, Mohamad Jaber and Joseph Sifakis. S.Bliudze @ TGC, Rome, 5th of

S.Bliudze @ TGC, Rome, 5th of September, 2014 / 1715

• Architecture-based • External • Declarative • Highly abstract • Relies on an execution engine • Easy to understand, analyse

and manipulate

• Architecture-agnostic • Internal • Imperative • Detailed • Relies on low-level primitives • Efficient

Two sides of the same design

Page 30: Architectures: Design Patterns for Component-Based … · Joint work with: Paul Attie, Eduard Baranov, Marius Bozga, Mohamad Jaber and Joseph Sifakis. S.Bliudze @ TGC, Rome, 5th of

S.Bliudze @ TGC, Rome, 5th of September, 2014 / 1715

• Architecture-based • External • Declarative • Highly abstract • Relies on an execution engine • Easy to understand, analyse

and manipulate

• Architecture-agnostic • Internal • Imperative • Detailed • Relies on low-level primitives • Efficient

Two sides of the same design

Internalisation

Page 31: Architectures: Design Patterns for Component-Based … · Joint work with: Paul Attie, Eduard Baranov, Marius Bozga, Mohamad Jaber and Joseph Sifakis. S.Bliudze @ TGC, Rome, 5th of

S.Bliudze @ TGC, Rome, 5th of September, 2014 / 17

Conclusion• Architectures solve coordination problems by enforcing

characteristic properties.

• First steps toward the study of a rigorous concept of architecture and its effective use for achieving correctness by construction in a system design flow. • A notion of architecture in BIP • Safety-preserving architecture composition operator

• [SEFM 2014] A General Framework for Architecture Composability • Architecture internalisation using Top/Bottom component model

• [CBSE 2014] Architecture internalisation in BIP

16

Page 32: Architectures: Design Patterns for Component-Based … · Joint work with: Paul Attie, Eduard Baranov, Marius Bozga, Mohamad Jaber and Joseph Sifakis. S.Bliudze @ TGC, Rome, 5th of

S.Bliudze @ TGC, Rome, 5th of September, 2014 / 17

Future work• Modelling

• Study and classification of real-life architectures in various domains (Embedded systems, web services, enterprise integration, etc.)

• Versatility of the model • Dynamic architectures

• Specification • Development of a simple powerful language for specifying architectures

and their characteristic properties

• Efficiency & distribution • Optimisation of internalised architectures • Implementation based on message-passing mechanisms (e.g. AKKA)

17

Page 33: Architectures: Design Patterns for Component-Based … · Joint work with: Paul Attie, Eduard Baranov, Marius Bozga, Mohamad Jaber and Joseph Sifakis. S.Bliudze @ TGC, Rome, 5th of

Thank you for your attention