Making system composition flexible, automatic, safe, practical. . . - - PowerPoint PPT Presentation

making system composition flexible automatic safe
SMART_READER_LITE
LIVE PREVIEW

Making system composition flexible, automatic, safe, practical. . . - - PowerPoint PPT Presentation

Making system composition flexible, automatic, safe, practical. . . (but not always at the same time) Stephen Kell Stephen.Kell@cl.cam.ac.uk Making systems composition. . . p.1/29 Introduction and running order An informal and incomplete


slide-1
SLIDE 1

Making system composition flexible, automatic, safe, practical. . .

(but not always at the same time) Stephen Kell

Stephen.Kell@cl.cam.ac.uk

Making systems composition. . . – p.1/29

slide-2
SLIDE 2

Introduction and running order

An informal and incomplete survey of work by DJG and co. corrections, heckles, interruptions all welcome Priority was assigned based on responsiveness factor. So hopefully

15 minutes on my work

10 minutes on David’s

7.5 minutes on Atif’s

5 minutes on Jin’s

2 minutes each on Yiannis, Henry, Tope, Aisha, Behzad

Making systems composition. . . – p.2/29

slide-3
SLIDE 3

Unifying themes

Some partially-unifying themes: communication within “open”, modular and/or distributed systems theory meets practice weak distinction between hardware and software

Making systems composition. . . – p.3/29

slide-4
SLIDE 4

My work: problem statement

Writing software from scratch is expensive. Avoid it: re-use. re-use is hard too, because of various flavours of mismatch: interface (operations, signatures, protocol, encoding) architectural (structural assumptions) “packaging” (choices of binary concretion, communication abstractions) kinds of re-use: white-, grey-, black-box (decreasing invasiveness) (Theorem:) re-use inevitably involves adaptation

Making systems composition. . . – p.4/29

slide-5
SLIDE 5

Motivating tasks

Here are some tasks which are difficult using existing tools: porting an application to use comparable but different supporting software e.g. GTK+ app to Qt; IE plugin to Firefox; composing heterogeneous components within the same application linking a web form with a C program linking a Perl script with a spreadsheet function What I propose: practical systems-level black-box adaptation. . . . . . making these tasks measurably less complex

Making systems composition. . . – p.5/29

slide-6
SLIDE 6

Approach

What does systems-level mean? It means we do adaptation close to run-time (typically after deployment) at the linkage level (i.e. typically on binary representations) Why are these good things? important class of mismatches only show up close to deployment e.g. library versioning problems

  • thers are easier to deal with later, when more context

is known consider adapting a JVM Goal: separate functionality from all details of integration.

Making systems composition. . . – p.6/29

slide-7
SLIDE 7

Inspirations and observations

Linking languages, esp. Knit (Reid et al, OSDI ’00): simple, flexbile, declarative description of linkage graph adaptation by symbol renaming (only) a convenient place to add further adaptation features. . . Scripting languages (“glue”): brevity (→ easy invasive changes) expressivity (← many convenience features) support many/most OS communication mechanisms explicit adaptation features (regex-based rewriting) complex and error-prone! How can we get the best of both worlds?

Making systems composition. . . – p.7/29

slide-8
SLIDE 8

Early decisions and concepts

“Configuration languages”: languages expressing structure examples: linking, module interconnection, architecture description, . . . form a spectrum parallel to programming languages benefit: make structure explicit benefit: separate static from dynamic may or may not have explicit hierarchy hierarchy helps exploit recursiveness of re-use? Idea: build a linkage-level configuration language supporting adaptation.

Making systems composition. . . – p.8/29

slide-9
SLIDE 9

An example configuration

Process

stream consumer tuple producer tuple space tuple-stream adapter take_contiguous(n)

map project #2; flatten

tuple space

(20, b100101…) (21, b011000…) (22, b111010…) (24, b000110…) …

  • ut

read

Making systems composition. . . – p.9/29

slide-10
SLIDE 10

Knit-like code for the example (1)

// simplified Knit-esque syntax with added adaptation features unit myTupSpc { exports [ prod { (int, bit list) in_ordered() }, cons { void

  • ut(int, bit list) } ];

files { obj_elf("C", tuplespace.o) } } unit myTupleProducer { imports [ dest { void output(bit list, int) } ]; exports [ /* ... */ ]; files { obj_elf("C", tupleprod.o) } } unit myStreamConsumer { imports [ streamProvider { int read(byte addr, int) } ]; exports [ /* ... */ ]; files { obj_elf("C", streamcons.o) } }

Making systems composition. . . – p.10/29

slide-11
SLIDE 11

Knit-like code for the example (2)

unit takeContiguous { imports [ source { (int, bit list) in_monotonic() } ]; exports [ listProvider { (int, bit list) list get() } ]; files { obj_elf("C", take_contig.o) } } unit Process { exports [ /* ... */ ]; link exec_elf("process") { myTupleProducer.dest <- myTupSpc.cons { output(a, b) <- out(b, a) } takeContiguous.source <- myTupSpc.prod { in_monotonic <- in_ordered } myStreamConsumer.streamProvider <- { read <- flatten(map (project #2), takeContiguous.listProvider.get) } } }

Making systems composition. . . – p.11/29

slide-12
SLIDE 12

Summary of the design

Key points: usual languages are for implementing functionality tackle integration in the linkage domain The following features to be important: explicit hierarchy ad-hoc adaptation in the configuration language (convenience) set of adaptations is open; may define externally allows for generative adaptation

Making systems composition. . . – p.12/29

slide-13
SLIDE 13

What can you do after that?

So far, so good. What cool things come next? apply adaptation algorithms (e.g Yellin & Strom) case studies (re-use features from Firefox; translate plug-ins) demonstrate reduced coupling measurement might need new coupling measure based on interface complexity re-implement as dynamic loading refactor existing code pluggable checking Time I got coding on all of that. Enough about my work!

Making systems composition. . . – p.13/29

slide-14
SLIDE 14

David (1): Orangepath compiler

Orangepath: synthesis of hardware/software systems Different deployments mean different requirements: different object-level representations different partitionings between hardware and software Idea: use the hourglass approach. many input formats (some high-level, nondeterministic) goal-based refinement engine (various algorithms) many output formats Verilog, SystemC, H2 bytecode, microcontroller code some may be fed back as input automatic hardware/software partitioning

Making systems composition. . . – p.14/29

slide-15
SLIDE 15

Orangepath picture

H2 Source Verilog Source IMP Microcode CIL .net assembler VM btyecode MULTI-FORMAT SIMULATOR Waveform VCD TRACES SSMG Imperative Code Assertions RTL Gate Compiler H/W Synthesis Assertions Imperative Code Verilog Netlist IMP Microcode C/C++ SystemC Stimulus Generator H2 TOOL Microcode Compiler RTL+Bev Verilog Temporal Logic Compiler Convert to C

Making systems composition. . . – p.15/29

slide-16
SLIDE 16

About the H2 compiler

Compiler internals: internal representation is H2 machine hierarchically structured imperative machine contains variable declarations, executable code and goals (assertions) various refinement algorithms: . . . , SAT-based also contains a simulator: generates output traces based on manually-specified stimulus, or rule-constrained pseudo-random stimuli

Making systems composition. . . – p.16/29

slide-17
SLIDE 17

Orangepath: exciting recent work

Original compiler front-end used custom H2 language reminiscent of C + Verilog Recent work adds .NET CIL “front”-end joint work with Satnam Singh supports code in (subsets of) any .NET-ported language!

Making systems composition. . . – p.17/29

slide-18
SLIDE 18

David (2): Pushlogic

Consider a “home area network”. . . . . . or any other domain with dynamic population of independent components strong local connectivity e.g. car, factory, . . . Problem: want components to interact usefully (“do the right thing”) with a minimum of human effort not interact harmfully with some automatic level of assurance

Making systems composition. . . – p.18/29

slide-19
SLIDE 19

Feature interaction

Feature interaction is a common problem. Examples: telephony: e.g. call screening + forward-when-busy = ? concurrent processes trying to set different TV channels vacation message to mailing list Classification of feature interactions: shared trigger (typically race conditions) sequential trigger (unanticipated consequence) looping (special case of above) missed trigger (example?)

Making systems composition. . . – p.19/29

slide-20
SLIDE 20

The Pebbles model

Idea: separate out proactive from reactive. reactive “pebbles” contain core functionality proactive scripts wire them together into applications centralised manager, implementing tuple-space Require both pebbles and scripts to describe their own behaviour: pebbles are controlled by local bundles of bytecode scripts are also bundles of bytecode all of these can be expressed in the Pushlogic language safety conditions are described by always clauses Turn behaviour into LTS; safety conditions into CTL; can model-check.

Making systems composition. . . – p.20/29

slide-21
SLIDE 21

Pushlogic example: CD player (1)

def bundle PioneerDvd() { input devices#keypad#now : { Stop : Play Pause Eject Tfwd Trwd};

  • utput works#cmd : {stop : play pause resume eject};
  • utput devices#keypad#playled : {0 : 1};
  • utput devices#keypad#pauseled : {0 : 1};
  • utput devices#keypad#stopled : {0 : 1};

input parts#mech#stat#track : {0..99}; input parts#mech#stat#sec : {0..59}; input parts#mech#stat#min : {0..99}; input parts#mech#stat#idx : {0..99};

  • utput parts#disp#track : {0..99};
  • utput parts#disp#sec : {0..59};
  • utput parts#disp#min : {0..99};
  • utput parts#disp#idx : {0..99};

Making systems composition. . . – p.21/29

slide-22
SLIDE 22

Pushlogic example: CD player (2)

with devices#keypad if (#now == stop) { #(playled, pauseled, stopled) := (0,0,1); works#cmd := stop; } else if (#now == play) { #(playled, pauseled, stopled) := (1,0,0); works#cmd := play; } else if (#now == pause) { // This bit is not idempotent - expect a compile time warning! if (works#cmd == play) { #(playled, pauseled, stopled) := (1,1,0); works#cmd := pause; } else { #(playled, pauseled, stopled) := (1,0,0); works#cmd := play; } }

Making systems composition. . . – p.22/29

slide-23
SLIDE 23

Checking and dynamism

This approach to checking has at least two notable advantages: check both proactive and reactive code (c.f. service description/discovery) can dynamically check application code (c.f. proof-carrying)

Making systems composition. . . – p.23/29

slide-24
SLIDE 24

Turning bytecode into LTS

Translation of bytecode into model-checkable LTS:

  • 1. split off start-up path (fork threads, allocate storage,

execute ctors, . . . ) can run this path before checking determines finite state size requires constraints on CIL s.t. no dyn storage alloc’d outside constructors

  • 2. in main loop, create one state for

each blocking CIL primitive, and each program label reachable through more than

  • ne path
  • 3. annotate arcs with I/O operations and variable updates

This yields a LTS checkable for various properties. . .

Making systems composition. . . – p.24/29

slide-25
SLIDE 25

Making model checking scale

Two classes of property may be specified in CTL: safety comparatively easy to model-check liveness hard to check because of non-monotonicity Can sometimes express liveness in the form of safety. . . Make model-checking scale better by skipping pebble internals (only bundles are checked) skipping state-space local to a pebble (dataflow analysis / ‘cone of influence’)

Making systems composition. . . – p.25/29

slide-26
SLIDE 26

Atif: binding using ontologies

Want to deploy “canned” (re-usable) scripts over our devices. Q: How do we bind formal pebbles to actual pebbles? A: Use ontologies. replace previous domain manager with ontology-aware

  • ne

relates concepts among devices; ontology itself is re-used can use semantic web rule language (SWRL) alongside Pushlogic

Making systems composition. . . – p.26/29

slide-27
SLIDE 27

Dynamic binding: rehydration

The dynamic binding mechanism is called rehydration. It is triggered when an application is launched; or a rule (Pushlogic or SWRL) is fired a canned ontology is deployed onto the domain a quantifier over entities is expanded

Making systems composition. . . – p.27/29

slide-28
SLIDE 28

Jin: SoC interface automata synthesis

Remember Orangepath?

  • ne key application is interface synthesis

i.e. synthesise glue between SoC IP blocks higher-level design and simulation → faster development Since most SoC IP blocks are specified in SystemC: extract finite-state protocol specs from SystemC SystemC → LLVM → H2 use various existing algorithms to synthesise adapters e.g. De Alfaro, “Interface Automata”, ESEC/FSE ’01 can also adapt between RTL and netlist-level interfaces

Making systems composition. . . – p.28/29

slide-29
SLIDE 29

Henry, Aisha, Tope, Behzad, questions

To close, a shambolic rounding-up of loose ends: Yiannis: secure multi-tier web application development collaborating with Andrew Gordon at MSR Henry: (take it away) Aisha: Tope: lots of Pushlogic work. . . the mysterious Behzad: requirements engineering, “pharmacological approach to refactoring” That’s all, folks. Questions?

Making systems composition. . . – p.29/29