Assemblages: Modules with Interfaces for Dynamic Linking and - - PowerPoint PPT Presentation

assemblages modules with interfaces for dynamic linking
SMART_READER_LITE
LIVE PREVIEW

Assemblages: Modules with Interfaces for Dynamic Linking and - - PowerPoint PPT Presentation

Assemblages: Modules with Interfaces for Dynamic Linking and Communication Yu David Liu and Scott F. Smith The Johns Hopkins University Assemblages:Modules with InterfacesforDynamic Linking and Communication p.1 The Main Design Principle


slide-1
SLIDE 1

Assemblages: Modules with Interfaces for Dynamic Linking and Communication

Yu David Liu and Scott F. Smith The Johns Hopkins University

Assemblages:Modules with InterfacesforDynamic Linking and Communication – p.1

slide-2
SLIDE 2

The Main Design Principle Every form of interaction of code with the environment should be supported by explicit, declared interfaces.

Assemblages:Modules with InterfacesforDynamic Linking and Communication – p.2

slide-3
SLIDE 3

A Typical Module

Examples: Functors, Mixins

Assemblages:Modules with InterfacesforDynamic Linking and Communication – p.3

slide-4
SLIDE 4

Modern Language Interactions

Main forms of interaction include

  • Code-code interaction via static linking
  • Code-runtime interaction via dynamic

linking

  • Runtime-runtime interaction via

distributed messaging

Assemblages:Modules with InterfacesforDynamic Linking and Communication – p.4

slide-5
SLIDE 5

Our Approach: Assemblages

A module-centric approach to interfaces for all three

Static linking of assemblages—mostly standard stuff

Main contributions: – Module-centric view of dynamic extensibility and distributed messaging – Unified treatment of all three, using related notions

  • f interface

Assemblages:Modules with InterfacesforDynamic Linking and Communication – p.5

slide-6
SLIDE 6

Code and Runtime

Assemblages are code units—modules

Assemblage runtimes are loaded assemblages

Assemblages:Modules with InterfacesforDynamic Linking and Communication – p.6

slide-7
SLIDE 7

Static Linking Illustrated

Assemblages with static linkers being linked together:

Assemblages:Modules with InterfacesforDynamic Linking and Communication – p.7

slide-8
SLIDE 8

Static Linking Illustrated

Assemblages with static linkers being linked together:

Assemblages:Modules with InterfacesforDynamic Linking and Communication – p.7

slide-9
SLIDE 9

Static Linking Illustrated

Assemblages with static linkers being linked together:

Assemblages:Modules with InterfacesforDynamic Linking and Communication – p.7

slide-10
SLIDE 10

Dynamic Linking

Gaussian cano Sensing Main

Assemblages:Modules with InterfacesforDynamic Linking and Communication – p.8

slide-11
SLIDE 11

Dynamic Linking

Gaussian cano Sensing Main

Assemblages:Modules with InterfacesforDynamic Linking and Communication – p.8

slide-12
SLIDE 12

Dynamic Linking

Gaussian cano Sensing Main h1

Assemblages:Modules with InterfacesforDynamic Linking and Communication – p.8

slide-13
SLIDE 13

Rebindability of Dynamic Linkers

Problem: The need to allow arbitrary code extension vs Fact that only a fixed number of dynamic linkers can be

  • n an assemblage

Solution: – Allow multiple simultaneous linkings on a single dynamic linker – Get a different name ("handle") to access each one – Unlinking is implicit via garbage collection when handle is unreachable – Use of handles also avoids an “unlinked” error – if you have a handle, it references a real plugin

Assemblages:Modules with InterfacesforDynamic Linking and Communication – p.9

slide-14
SLIDE 14

Rebindability illustrated

Gaussian cano Sensing Main h1

Assemblages:Modules with InterfacesforDynamic Linking and Communication – p.10

slide-15
SLIDE 15

Rebindability illustrated

Poisson Gaussian cano Sensing Main h1

Assemblages:Modules with InterfacesforDynamic Linking and Communication – p.10

slide-16
SLIDE 16

Rebindability illustrated

Poisson Gaussian cano Sensing Main h1 h2

Assemblages:Modules with InterfacesforDynamic Linking and Communication – p.10

slide-17
SLIDE 17

Rebindability illustrated

Poisson Gaussian cano Sensing Main Non-Parametric h1 h2

Assemblages:Modules with InterfacesforDynamic Linking and Communication – p.10

slide-18
SLIDE 18

Rebindability illustrated

Poisson Gaussian cano Sensing Main Non-Parametric h1 h2 h3

Assemblages:Modules with InterfacesforDynamic Linking and Communication – p.10

slide-19
SLIDE 19

Dynamic Linking Tree

Poisson Gaussian cano Sensing Main Non-Parametric h1 h2 h3

Assemblages:Modules with InterfacesforDynamic Linking and Communication – p.11

slide-20
SLIDE 20

Dynamic Linking Tree

Poisson Gaussian cano Sensing Main Expt1 Non-Parametric h1 h2 h3

Assemblages:Modules with InterfacesforDynamic Linking and Communication – p.11

slide-21
SLIDE 21

Dynamic Linking Tree

Poisson Gaussian cano Sensing Main Non-Parametric Non-Parametric Expt1 h1 h2 h3

Assemblages:Modules with InterfacesforDynamic Linking and Communication – p.11

slide-22
SLIDE 22

Dynamic Linking Tree

Poisson Gaussian cano Sensing Main Non-Parametric Expt1 Non-Parametric h1 h2 h3 h4

Assemblages:Modules with InterfacesforDynamic Linking and Communication – p.11

slide-23
SLIDE 23

Dynamic Linking Tree

Poisson Gaussian cano Sensing Main Non-Parametric Expt1 Non-Parametric Expt2 h1 h2 h3 h4

Assemblages:Modules with InterfacesforDynamic Linking and Communication – p.11

slide-24
SLIDE 24

Dynamic Linking Tree

Poisson Gaussian cano Sensing Main Non-Parametric Expt2 Expt1 Non-Parametric h1 h2 h3 h4 h5

Assemblages:Modules with InterfacesforDynamic Linking and Communication – p.11

slide-25
SLIDE 25

Connectors for Messaging

Connectors allow different assemblage runtimes to interact

Aim is a cleaner notion to replace RMI/RPC – RMI/RPC lacks a declared interface of interaction

Connectors in programming languages are not completely new – Previously used in e.g. Cells and ArchJava and Darwin

Assemblages:Modules with InterfacesforDynamic Linking and Communication – p.12

slide-26
SLIDE 26

Distributed Messaging Illustrated

✂ ✄ ☎

cano Sensing Main

✆ ✝ ✞

p Sensor 1

Assemblages:Modules with InterfacesforDynamic Linking and Communication – p.13

slide-27
SLIDE 27

Distributed Messaging Illustrated

✂ ✄ ☎

cano Sensing Main

✆ ✝ ✞

p Sensor 1

Assemblages:Modules with InterfacesforDynamic Linking and Communication – p.13

slide-28
SLIDE 28

Distributed Messaging Illustrated

✂ ✄ ☎

cano Sensing Main

✆ ✝ ✞

p Sensor 1 hc1

Assemblages:Modules with InterfacesforDynamic Linking and Communication – p.13

slide-29
SLIDE 29

Distributed Messaging Illustrated

✂ ✄ ☎

cano Sensing Main

✆ ✝ ✞

p Sensor 2

✆ ✝ ✞

p Sensor 1

✆ ✝ ✞

p Sensor 3 hc1

Assemblages:Modules with InterfacesforDynamic Linking and Communication – p.13

slide-30
SLIDE 30

Distributed Messaging Illustrated

✂ ✄ ☎

cano Sensing Main

✆ ✝ ✞

p Sensor 2

✆ ✝ ✞

p Sensor 1

✆ ✝ ✞

p Sensor 3 hc1 hc3 hc2

Assemblages:Modules with InterfacesforDynamic Linking and Communication – p.13

slide-31
SLIDE 31

Data Encapsulation

Goal: maintain sanctity of the runtime interfaces

Only access internals of a runtime through its interfaces

RMI/RPC violate the sanctity of interfaces – Object references can be passed around – No external interface on modules for potential RMI interactions Thus we enforce the following

No passing of object references across the network

Objects can be copied, but only if their code is already plugged in on the other side

Runtime references can be passed

Assemblages:Modules with InterfacesforDynamic Linking and Communication – p.14

slide-32
SLIDE 32

The Unification

✟ ✠ ✡ ✠☛ ✡ ☞✌ ✍✎ ✏ ✑ ✒ ✓ ✍ ✌ ☞ ✡ ☞ ☛ ☞ ✎ ✍✎ ✏ ✑ ✒ ✓ ✔ ✠ ✡ ✕ ☞✌

kLib

✖ ✠✗ ✘ ✙ ✏ ✠ ✌

y

✖ ✠✗ ✘ ✚ ✠ ✘ ☞✌ ✡ ✛ ☞ ✎ ☛ ✜ ✓ ☞ ✢ ✠ ✓✣ ✒ ✓ ✑ ✤

ain

Assemblages:Modules with InterfacesforDynamic Linking and Communication – p.15

slide-33
SLIDE 33

The Unification

✟ ✠ ✡ ✠☛ ✡ ☞✌ ✍✎ ✏ ✑ ✒ ✓ ✍ ✌ ☞ ✡ ☞ ☛ ☞ ✎ ✍✎ ✏ ✑ ✒ ✓ ✔ ✠ ✡ ✕ ☞✌

kLib

✖ ✠✗ ✘ ✙ ✏ ✠ ✌

y

✖ ✠✗ ✘ ✚ ✠ ✘ ☞✌ ✡ ✛ ☞ ✎ ☛ ✜ ✓ ☞ ✢ ✠ ✓✣ ✒ ✓ ✑ ✤

ain

✔ ✠ ✡ ✥ ✒✦ ✌ ✜ ✌

y

✔ ✠ ✡ ✕ ☞✌

kLib

Assemblages:Modules with InterfacesforDynamic Linking and Communication – p.15

slide-34
SLIDE 34

The Unification

✧ ★ ✩ ★✪ ✩ ✫✬ ✭✮ ✯✰ ✱ ✲ ✭ ✬ ✫ ✩ ✫ ✪ ✫ ✮ ✭✮ ✯ ✰ ✱ ✲ ✳ ★ ✩ ✴ ✫✬

kLib

✵ ★✶ ✷ ✸ ✯ ★ ✬

y

✵ ★✶ ✷ ✹ ★ ✷ ✫ ✬ ✩ ✺ ✫ ✮ ✪ ✻ ✲ ✫ ✼ ★ ✲✽ ✱ ✲ ✰ ✾

ain

✳ ★ ✩ ✿ ✱❀ ✬ ✻ ✬

y

Assemblages:Modules with InterfacesforDynamic Linking and Communication – p.15

slide-35
SLIDE 35

The Unification

❁ ❂ ❃ ❂❄ ❃ ❅❆ ❇❈ ❉❊ ❋
❆ ❅ ❃ ❅ ❄ ❅ ❈ ❇❈ ❉❊ ❋
❂■ ❏ ❑ ❉ ❂ ❆

y

❍ ❂■ ❏ ▲ ❂ ❏ ❅❆ ❃ ▼ ❅ ❈ ❄ ◆
❖ ❂
  • P

ain

Assemblages:Modules with InterfacesforDynamic Linking and Communication – p.15

slide-36
SLIDE 36

The Code

❘❚❙ ❯❚❱❲ ❳ ❙ ❨ ❲ ❩ ❳ ❬

// Volcano sensor example

❭❪ ❪❫ ❴ ❵❛ ❭❜ ❫ ❝ ❪ ❞ ❭ ❞ ❡❣❢ ❛ ❡✐❤ ❥ ❫ ❦ ❧❚♠ ♥ ♦ ❩ ♣ ❝

. . . statically linking some network library . . .

q r✐s ❤ ❭ ❴ ❡❣❢ ❛ ❡ ❤ ❥ ❫ ❦ t ♠ ♥ ♠ ❱ ♥ ❙ ✉ ✈ ❯✐✇ ① ❩ ❳ ❝ ❡ ❴② ③ ❦ ❞ ④ ♠ ♥ ♠ ❱ ♥ ❨ ♠ ♥ ⑤ ❙ ④ ⑥⑦ ❫ ⑧ ② ③ ❦ ❞ ① ♠ ♥ ⑨ ❳ ⑩ ❬ ❬

. . . get current environment snapshot . . .

q ❢ ③ ❤ ❤ ❫ ❢ ❞ ③ ❦ ❶ ❙ ④ ♠ ❷❣❸ ④ ❲ ♥ ♠ ❝ ❡ ❴② ③ ❦ ❞ ① ♠ ♥ t ♠ ♥ ♠ ❱ ♥ ❶ ❙ ④ ♠ ⑥ ⑦❺❹ ❫ ⑧ ② ③ ❦ ❞ ❱ ⑤ ♠ ❱ ❻ ⑥❽❼❾ ❿ ➀ ➁ ➂ ➁ ❾ ❿ ⑦ ❬ ❬

. . . check applicability of detect model . . .

q ➃ ➃ ➃

// local feature implementation

✇ ❸ ④ ❲ ♥ ♠ t ♠ ♥ ♠ ❱ ♥ ❙ ✉ ❬ ❬ ➄➆➅ ➃ ⑥ ❛ ❫ ❞ ❼ ➇ ❬ ❢ ③ ❤ ❤ ❫ ❢ ❞➉➈➋➊ ➌➎➍ ➏➋➐ ➌➎➑ ➒ ➍ ➓ ➔ ➈➋➊ ➌➎➍ ➅ ❡✐❤ ❛ ❫ ❞ ❼❾ ➀➆→ ❬ ❼ ➇➋➣ ① ♠ ♥ t ♠ ♥ ♠ ❱ ♥ ❶ ❙ ④ ♠ ↔ ⑥⑦ ❡ ❤ ❛ ❫ ❞ ❼❾ ↕➙ ❬ ② ❛❣➛ ❜ ❡✐❤ ➜ ➍ ➒ ➍➝ ➒ ➊ ➞ ➟➠➢➡ ➤ ➥➋➦ ➓ ➔ ➜ ➍ ➒ ➍➝ ➒ ❼❾ ➀➆→ ❡✐❤ ❼❾ ↕ ➙ ➃ ④ ♠ ♥ ♠ ❱ ♥ ❨❚♠ ♥ ⑤ ❙ ④ ⑥⑦ ⑦ ➃ ➃ ➃ q

Assemblages:Modules with InterfacesforDynamic Linking and Communication – p.16

slide-37
SLIDE 37

The Type System

Static linkers, dynamic linkers, and connectors are typed

Each import/export is typed

There may be more exports than imports (subtyping)

Assemblage runtime types are the connector types

First-class assemblage types are static/dynamic linkers and connector types

Assemblages:Modules with InterfacesforDynamic Linking and Communication – p.17

slide-38
SLIDE 38

Technical Accomplishments

Formal operational semantics

Type system

Soundness via a subject reduction argument – Significant extra complication here due to multiple runtimes, modules as first-class values etc

Extension to have types as features on linkers (not proved sound)

Assemblages:Modules with InterfacesforDynamic Linking and Communication – p.18

slide-39
SLIDE 39

Related Work

Explicit interfaces are there to some degree

Static linking – “solved” in many module systems/calculus.

Dynamic linking – Java classloaders: not explicit; very fine-grained – Units, Argus, MJ, etc have partial interface support

  • n code being linked, but not on the runtime

Distributed langauge-based messaging – Existing protocols bury interactions in the code – RPC/RMI: When remote objects are passed between JVM’s, you don’t even know who you are talking to – Connectors

Assemblages:Modules with InterfacesforDynamic Linking and Communication – p.19

slide-40
SLIDE 40

Future Work

Implementation

Ensemble: A connector-based Sensornet language

MVM: a Microkernel Virtual Machine

Extensions – Inference of signatures from assemblages – Linker- and connector-based security – Version control

Assemblages:Modules with InterfacesforDynamic Linking and Communication – p.20