52
©Magee System Architecture: the Darwin Approach 1 Jeff Magee Department of Computing Imperial College of Science, Technology and Medicine 180 Queen’s Gate, London SW7 2BZ, UK. Software Architecture: the Darwin Approach

Jeff Magee

  • Upload
    fergus

  • View
    55

  • Download
    0

Embed Size (px)

DESCRIPTION

Software Architecture: the Darwin Approach. Jeff Magee. Department of Computing Imperial College of Science, Technology and Medicine 180 Queen’s Gate, London SW7 2BZ, UK. Architecture, Analysis, Animation & Application. Software Architecture Behavioural Analysis Graphic Animation - PowerPoint PPT Presentation

Citation preview

Page 1: Jeff Magee

©Magee System Architecture: the Darwin Approach 1

Jeff MageeDepartment of Computing

Imperial College of Science, Technology and Medicine180 Queen’s Gate, London SW7 2BZ, UK.

Software Architecture: the Darwin Approach

Page 2: Jeff Magee

©Magee System Architecture: the Darwin Approach 2

Architecture, Analysis, Animation & Application

Software Architecture

Behavioural Analysis

Graphic Animation

Application - Koala

Page 3: Jeff Magee

©Magee System Architecture: the Darwin Approach 3

Architecture Description

Structural View

Behavioural View

Analysis

Construction View

Implementation

DarwinADL

Page 4: Jeff Magee

©Magee System Architecture: the Darwin Approach 4

Emphasis in this talk…

The use of tool supported incremental, interactive behaviour analysis during architecture development.

The use of graphic animation to understand and communicate analysis artefacts.

The application of this approach to atelevision product family.

Page 5: Jeff Magee

©Magee System Architecture: the Darwin Approach 5

Examples using…

Architecture Description using Darwin

Animation using SceneBeans

Behaviour Modelling & Analysis using Labelled Transition System Analyser (LTSA)

Page 6: Jeff Magee

©Magee System Architecture: the Darwin Approach 6

A simple e-commerce system…

CLIENT SERVER

WALLETWALLET

request

transfer,null

authorise

reply,abort

invoice

confirm, default

Client requests service from server which is paid for by a transfer from client’s wallet to server’s wallet.

Page 7: Jeff Magee

©Magee System Architecture: the Darwin Approach 7

Components & Services…

CLIENT

walletservice

Service type defined by a set of actions:

set Wallet = {authorise, invoice, confirm, default}

set Service = {request, reply, abort}

SERVERservice

wallet

requiredprovidedunspec.

Page 8: Jeff Magee

©Magee System Architecture: the Darwin Approach 8

CLIENT behaviour

Modelled by LTS:CLIENT

wallet.authorise service.request

service.replyservice.abort

0 1 2

Specified in FSP:

CLIENT = (wallet.authorise -> service.request -> (service.reply -> CLIENT |service.abort -> CLIENT ) )+{wallet.Wallet,service.Service}.

Page 9: Jeff Magee

©Magee System Architecture: the Darwin Approach 9

SERVER behaviour

SERVERservice.request wallet.invoice

wallet.confirm

wallet.default

service.reply

service.abort

0 1 2 3 4

LTS:

FSP:SERVER = (service.request -> wallet.invoice -> (wallet.confirm -> service.reply ->SERVER |wallet.default -> service.abort ->SERVER ) )+{wallet.Wallet,service.Service}.

Page 10: Jeff Magee

©Magee System Architecture: the Darwin Approach 10

System Composition

client:CLIENT

server:SERVER

cw:WALLET

sw:WALLET

service

transfer

client.wallet server.wallet

Darwin:

Structure described using instantiation and binding.

Page 11: Jeff Magee

©Magee System Architecture: the Darwin Approach 11

Behaviour model composition||SES =( client:CLIENT ||server:SERVER ||cw:WALLET(2) ||sw:WALLET(0) )/{ service/{client,server}.service, client.wallet/cw.wallet, server.wallet/sw.wallet, transfer/{cw,sw}.transfer, null/{cw,sw}.null }.

Darwin component instantiation maps directly to parallel composition and binding to relabelling.

• Parallel composition || generates an LTS that represents all possible interleaving of the actions.

• Processes synchronise on shared actions.

Page 12: Jeff Magee

©Magee System Architecture: the Darwin Approach 12

Analysis

Interactive execution

Safety analysis

Progress analysis

Page 13: Jeff Magee

©Magee System Architecture: the Darwin Approach 13

Reachability analysis for checking models

Deadlock - state with no outgoing transitions.

ERROR () state -1 is a trap state. Undefined transitions are automatically mapped to the ERROR state.

30 1 2-1ERRORstate

Deadlockstate

Exhaustive state space search for:

Page 14: Jeff Magee

©Magee System Architecture: the Darwin Approach 14

Safety - property automata

Safety properties are specified by deterministic finite state processes called property automata. These generate an image automata which is transparent for valid behaviour, but transitions to an ERROR state otherwise. /* If a payment transfer occurs the service should be delivered

otherwise if no payment, no service*/property HONEST = (transfer -> service.reply -> HONEST |null -> service.abort -> HONEST ).

||CHECK = (SES || HONEST).

Page 15: Jeff Magee

©Magee System Architecture: the Darwin Approach 15

Liveness - progress properties

LTSA supports a limited class of liveness properties, called progress, which can be checked efficiently :

[]a[]a []b

i.e. Progress properties check that, in an infinite execution, particular actions occur infinitely often.

/* It should always be the case that the service either eventually replies or aborts*/

progress LIVE_SERVICE = {service.{reply,abort}}

Page 16: Jeff Magee

©Magee System Architecture: the Darwin Approach 16

Compositional Reachability Analysis:We construct the system incrementally from subcomponents, based on the software architecture.State reduction is achieved by hiding actions not in their interfaces and minimising. Property checks remain in the minimised subcomponents.

Scalability

The problem with reachability analysis is that the state space “explodes” exponentially with increasing problem size.

How do we alleviate this problem?

Page 17: Jeff Magee

©Magee System Architecture: the Darwin Approach 17

Graphic Animation

The products of analysis are essentially action traces describing desirable or undesirable behaviours that the model has.

The purpose of graphic animation is to provide visualizations of these behaviours.

These visualizations can be in the context of the architecture or in the context of the problem domain.

Page 18: Jeff Magee

©Magee System Architecture: the Darwin Approach 18

Flexible Production Cell – example

Page 19: Jeff Magee

©Magee System Architecture: the Darwin Approach 19

A simpler example- CHAN

CHAN in

in

out

fail

0 1 2

LTS

CHAN = (in -> out -> CHAN |in -> fail -> CHAN ).

FSP

Page 20: Jeff Magee

©Magee System Architecture: the Darwin Approach 20

Timed Automata

Abstract animation activities by local clocks that measure the passage of time.

CHAN in, x := 0

in, x := 0

x Tc, out

x Tf, fail

0 1 2

Time passes in a state.

local clockvariable x

Page 21: Jeff Magee

©Magee System Architecture: the Darwin Approach 21

Animation Activities

commands: channel.begin -- corresponds to x := 0 explode conditions: channel.end -- corresponds to x Tc channel.fail -- corresponds to x Tf

channelStart of an activity

Signal as the activity progresses or ends

Page 22: Jeff Magee

©Magee System Architecture: the Darwin Approach 22

Annotating LTS with animation

CHAN in, channel.begin

in, channel.begin

channel.end, out

channel.fail, fail, explode

0 1 2

animation FAILCHAN = "channel.xml" actions { in / channel.begin, fail / explode } controls { out / channel.end, fail / channel.fail }

Mapping Relation

label/command (immediate actions)

label/condition (controlled actions)

Page 23: Jeff Magee

©Magee System Architecture: the Darwin Approach 23

Model-Animation Structure

LTSmodel Animationmappi

ng

actions

condition

s

commands

controlledactions

Timed Automata model

LTS + annotations

Page 24: Jeff Magee

©Magee System Architecture: the Darwin Approach 24

Models & Annotated models

Safety PropertiesThe annotated model cannot exhibit behavior thatis not contained in the base model:

Any safety property that holds for the base modelalso holds for the animated model.

Progress propertiesUseful approximation of the annotation is:

P>>Controlled -- make actions in Controlled low priority

Checkprogress NOZENO = { Controlled }

asserts animation is free of Zeno executions.

Page 25: Jeff Magee

©Magee System Architecture: the Darwin Approach 25

Composition - Timed Automata

a, x:=0 xTp, e

b, y:=0 yTq, e

P

Q

P||Qa, x:=0

b, y:=0

b, y:=0

a, x:=0

xTp yTq, e

Animations can be composed in the same way.

Page 26: Jeff Magee

©Magee System Architecture: the Darwin Approach 26

Animation Composition

An animation is defined by; the set of commands C, the set of conditions B the relation Actions -- maps LTS actions to commands the relation Controls -- maps LTS actions to conditions

animation M1 = C1, B1, Actions1, Controls1 animation M2 = C2, B2, Actions2, Controls2

animation M1 || M1 = C1 C2, B1 B2, Actions1 Actions2,

Controls1 Controls2

Animation Composition

Page 27: Jeff Magee

©Magee System Architecture: the Darwin Approach 27

SceneBeans

Scene Graph Behaviours Animation Thread

Page 28: Jeff Magee

©Magee System Architecture: the Darwin Approach 28

Example Scene Graph

behavior “channel” algorithm move

transform translate

image message

draw

image channel

command channel.begin

event channel.end

Page 29: Jeff Magee

©Magee System Architecture: the Darwin Approach 29

XML1      <?xml version="1.0"?>2      <!DOCTYPE animation SYSTEM "scenebeans.dtd">3      <animation width="400" height="136">4      <behavior id="channel" algorithm="move"5      event="channel.end">6      <param name="from" value="71"/>7      <param name="to" value="323"/>8      <param name="duration" value="2"/>9      </behaviour>10  <command name="channel.begin">11  <announce event = "~channel.end"/>12  <start behaviour= "channel"/>13  </command>14  <event object="channel" event="channel.end">15  <announce event="channel.end"/>16  </event>17  <draw>18  <transform type="translate">19  <param name="y" value="64"/>20  <animate param="x" behavior="channel"/>21  <image src="image/message.gif"/> 22  </transform>23  <image src="image/channel.gif"/>24  </draw>25 </animation>

Page 30: Jeff Magee

©Magee System Architecture: the Darwin Approach 30

Animation..

users & domain experts

requirements engineers

Facilitates communication between:

architects

Page 31: Jeff Magee

©Magee System Architecture: the Darwin Approach 31

Application - Televisions

Why is the Darwin ADL, which originated in distributed systems research, applicable to the construction of software for televisions?

Page 32: Jeff Magee

Product Families

Price

Features

MTV DVD

VCR StorageDevice

HDTVCR

TiVo

LCTV

VideoOutputDevice

PTV

FTVBroadcasting

Standard

DTV

Region

DataProcessing

ChipTechnology

Connectivity

UTV

Page 33: Jeff Magee

©Magee System Architecture: the Darwin Approach 33

Role of an ADL…

Uneconomic to design the software for each product from scratch.

Develop a set of software components.

Build the software for each product variant from an architectural description of that product.

Page 34: Jeff Magee

©Magee System Architecture: the Darwin Approach 34

Darwin applicability…

Darwin enforces a strict separation between architecture and components.

Variation supported by both different Darwin descriptions and parameterisation.

Variants can be constructed at compile-time or later at system start-time.

Page 35: Jeff Magee

©Magee System Architecture: the Darwin Approach 35

Koala

In the ARES project Rob van Ommering saw potential of Darwin in specifying television product architectures and developed Koala, based on Darwin, for Philips.

First large-scale industrial application of an ADL.

Page 36: Jeff Magee

©Magee System Architecture: the Darwin Approach 36

An industrial application of Darwin…

Interfacesare setsof Cfunctions

Resource constrained product familiesResource constrained product families

Structural diversity=

internal diversityat next higher level

Structural diversity=

internal diversityat next higher level

Koala (Philips)

Page 37: Jeff Magee

©Magee System Architecture: the Darwin Approach 37

Koala - example

Page 38: Jeff Magee

©Magee System Architecture: the Darwin Approach 38

Television Software Architecture

Behavioural Analysis Case Study:

Control of Signal Path usingHorizontal Communication

e.g. blanking screen during tuner frequency change

Page 39: Jeff Magee

©Magee System Architecture: the Darwin Approach 39

A simplified television

Txt

Sound

Dec

Scart

Tuner

Scart

Cinch

Dem

VOP

Dec Dem Tuner

PIP

Page 40: Jeff Magee

©Magee System Architecture: the Darwin Approach 40

Traditional Central Control

Tuner Screen

Control

Driver Driver S/W

H/W

Driver

new

signalpath

Page 41: Jeff Magee

©Magee System Architecture: the Darwin Approach 41

Distributed Control

Tuner Screen

Driver Driver S/W

H/Wsignalpath

TunerControl

ScreenControl

Driver

Controlcontrolpath

Page 42: Jeff Magee

©Magee System Architecture: the Darwin Approach 42

HorCom

TunerControl

TunerDriver

ScreenControl

ScreenDriver

HorizontalCommunicationProtocol

Page 43: Jeff Magee

©Magee System Architecture: the Darwin Approach 43

Scenario

TunerDriver

2.Drop

TunerControl

ScreenControl

ScreenDriver

3.Blank

false

1.Tune(f)

6.Change(f)

4.BlankAck

5.DropAck

9.Unblank 8.Restore 7.ChgAck

Page 44: Jeff Magee

©Magee System Architecture: the Darwin Approach 44

Behaviour Modelling

Model each component as FSP process(es).

TunerDriver

TUNERDRIVER = (change[False] -> TUNING |change[True] -> TUNERDRIVER ),TUNING = (chgAck -> TUNERDRIVER |change[False] -> TUNING ).

change[0]

change[1]

change[0]chgAck

0 1

Page 45: Jeff Magee

©Magee System Architecture: the Darwin Approach 45

Connectors

Connector protocol checked by property automata:

TunerControl

ScreenControl

WIRE

propertyWIRE = GREEN,GREEN = (drop -> (drop[False] -> ORANGE | drop[True] -> RED) ),ORANGE = (dropAck -> (dropAck.ret -> RED |restore -> restore.ret -> dropAck.ret -> GREEN ) ),RED = (restore -> restore.ret -> GREEN).

Page 46: Jeff Magee

©Magee System Architecture: the Darwin Approach 46

Animation & Analysis

Animation to validate model reflects requirements.

Model-check to verify properties.Demo…

Page 47: Jeff Magee

©Magee System Architecture: the Darwin Approach 47

In summary...

requirements

goalsuse casesassumptionsconstraintsproperties

architecturesmodelsanalysis

graphicalanimation

Illustrated a tool supported approach that facilitates early identification of and experimentation with architecture.

Page 48: Jeff Magee

©Magee System Architecture: the Darwin Approach 48

Software tools..

Automated software tools are essential to support software engineers in the design process. Techniques which are not amenable to automation are unlikely to survive in practice.

Experience in teaching the approach to both undergraduates and postgraduates in courses on Concurrency. Initial experience with R&D teams in industry (BT, Philips)

Page 49: Jeff Magee

©Magee System Architecture: the Darwin Approach 49

Software Tools – Lightweight vs. Heavyweight

Short learning curve. Immediate benefits.Support incremental construction,and facilitate interactive experimentation.

Traditional verification and analysis tools tend to require considerable expertise and have as their goal the ability to target large problems rather than ease of use.

vs.

Page 50: Jeff Magee

©Magee System Architecture: the Darwin Approach 50

Related Work – architecture/analysis

ADL Wright + FDR toolset

LOTOS + Caesar/Aldebaran

Promela + SPIN Our approach is distinguished by:

direct use of ADL to generate both analysis model & implementation, emphasis on compositionality.

Page 51: Jeff Magee

©Magee System Architecture: the Darwin Approach 51

Related Work - animation

Verification / Modelling ToolsStateMate – Widget SetSCR – instrument panel animationSPIN, Concurrency Factory, UPPAAL

– animation w.r.t. model sourceZ +graphic animation

- SVRC, Australia

Program AnimationTango/XTango – smooth animation of sequential

programsPavane – data parallel program animation via

state/visual mapping

Page 52: Jeff Magee

©Magee System Architecture: the Darwin Approach 52

Future directions…

Model construction using animation composition Model synthesis from scenarios Hybrid models Linear Temporal Logic Model Checking Performance Analysis

Emphasis on lightweight, accessible and interactive tools.

Tools available from: http://www-dse.doc.ic.ac.uk/concurrency/