SlideShare une entreprise Scribd logo
1  sur  34
Télécharger pour lire hors ligne
Asynchronous Software Evolution: Obtaining Type Safety
by Combining Type Checking and Runtime Constraints
Einar Broch Johnsen
(joint work with Ingrid Chieh Yu and others)
University of Oslo, Norway
einarj@ifi.uio.no
1st workshop on Architectures, Languages and Paradigms for IoT (ALP4IoT)
Torino, 18 September 2017
http://www.sirius-labs.no
What Do We Want To Talk About Today?
[Wikipedia]The Internet of Things
• Connected physical devices (also called “smart
devices”) with embedded software, sensors,
and actuators, which collect and exchange data
• Applications: Environmental monitoring,
infrastructure management, manufacturing,
agriculture, energy management, medical and
healthcare, building and home automation, …
• Currently, IoT has a strong engineering focus:
IoT gateways connect IoT devices and the cloud
Talk Overview
• Quick, informal intro to home automation
• Software evolution for asynchronous, loosely coupled systems
• Programming abstractions, typing, and behavioral reasoning
E. B. Johnsen (U. of Oslo) Asynchronous Software Evolution ALP4IoT, 18.09.2017 1 / 33
Connected, Smart Things
Whirlpool’s $1,699 “smart” washing machine
boasts Wi-Fi and a colored control screen, can
be started from an iPhone app, and will text or
email you when your clothes are ready to dry
(hopefully you dry them in a “smart” dryer).
But if you wonder who would want to buy an
Internet-enabled washing machine, you’re not
alone. Even Whirlpool’s not so sure.
“We’re a little bit of a hammer looking
for a nail right now,” said Chris Quatrochi,
Whirlpool’s global director of user experi-
ence and connectivity. The buyers of web-
connected washers, more than a year after
launch, are still “not at all widespread,” he
said. “Trying to understand exactly the value
proposition that you provide to the consumer
has been a little bit of a challenge.”
(Washington Post, October 28, 2014)
Can we help Mr Quatrochi
with some ideas?
E. B. Johnsen (U. of Oslo) Asynchronous Software Evolution ALP4IoT, 18.09.2017 2 / 33
Woolen Smart Things
“Smart Socks translate proven science into a design that
fits easily into your everyday life.”
All you have to do is put on socks like you would every day.
The temperature sensors are integrated into the fabric of
the sock, and the data is sent to your phone app.
Smart Socks are smart machine washable, smart machine
dryable, and do not need to be charged.
But how can the smart socks
get to the washing machine?
E. B. Johnsen (U. of Oslo) Asynchronous Software Evolution ALP4IoT, 18.09.2017 3 / 33
Smart Implants
“Let us connect the smart socks and the smart washing
machine to a controllable host, which can act as our mule”
(Image MIT)
E. B. Johnsen (U. of Oslo) Asynchronous Software Evolution ALP4IoT, 18.09.2017 4 / 33
Microprocessor Knees
(Images Össur)
Software upgrades propagatevia bluetooth to the MPKs!
E. B. Johnsen (U. of Oslo) Asynchronous Software Evolution ALP4IoT, 18.09.2017 5 / 33
Software Evolution in IoT
Distributed system of loosely connected
running software that needs to be maintained
E. B. Johnsen (U. of Oslo) Asynchronous Software Evolution ALP4IoT, 18.09.2017 6 / 33
Runtime Software Evolution
Different devices need maintenance
• Distributed system of loosely coupled devices
• Overall functionality depends on how the devices interact
Traditional solution to software upgrades
• Halt overall system behavior, recompile, restart
• Difficult to achieve in IoT setting
Need automated,
non-halting solution
E. B. Johnsen (U. of Oslo) Asynchronous Software Evolution ALP4IoT, 18.09.2017 7 / 33
DSU: Dynamic Software Updating
DSU : Techniques to update a running program
Existing approaches in practice
• Barrier solutions
All existing instances
must have expired
• Passive partitioning
Multiple coexisting versions
C++, AspectJ
• Global update / hot-swapping
dist. obj. databases, Java
• Asynchronous global
Erlang
E. B. Johnsen (U. of Oslo) Asynchronous Software Evolution ALP4IoT, 18.09.2017 8 / 33
DSU: Dynamic Software Updating
DSU : Techniques to update a running program
Related formal models
• Imperative: C, barrier, single
threaded, explicit primitive
• Object-oriented: AspectJ,
passive partitioning, multiple
versions, explicit primitive
• Module linking
• Reclassification
E. B. Johnsen (U. of Oslo) Asynchronous Software Evolution ALP4IoT, 18.09.2017 9 / 33
What Could Possibly Go Wrong?
In the asynchronous setting, DSU can introduce
races between regular execution and code evolution
Target
CallerDSU
Add method
m() Call to m()
Local upgrades can happen too late
Example: Call to a new method, but it is not yet available
E. B. Johnsen (U. of Oslo) Asynchronous Software Evolution ALP4IoT, 18.09.2017 10 / 33
What Could Possibly Go Wrong?
In the asynchronous setting, DSU can introduce
races between regular execution and code evolution
Target
CallerDSU
Remove
method m() Call to m()
Local upgrades can happen too early
Example: Call to an old method, but it has been removed
E. B. Johnsen (U. of Oslo) Asynchronous Software Evolution ALP4IoT, 18.09.2017 11 / 33
What Could Possibly Go Wrong?
In the asynchronous setting, DSU can introduce
races between regular execution and code evolution
Target
CallerDSU
Remove
method m() Call to m()
Local upgrades can happen too early
Example: Call to an old method, but it has been removed
Target
DSU
Add method
m()
DSU
Call method
m()
Upgrades can depend on other (delayed) upgrades
Example: An upgrade may call a method in another upgrade
E. B. Johnsen (U. of Oslo) Asynchronous Software Evolution ALP4IoT, 18.09.2017 12 / 33
Asynchronous DSU: The Allegory of the Cave
Static vs. runtime view
• We want to statically eliminate
such runtime errors
• …but we don’t know what has
happened (so far) at runtime
• Mismatch between static and
runtime view of the code
Technical part of talk coming up
• Formal approach to async.
runtime evolution
• Dynamic class calculus for
active objects
• Ensure that method binding
succeeds when programs
asynchronously evolve
E. B. Johnsen (U. of Oslo) Asynchronous Software Evolution ALP4IoT, 18.09.2017 13 / 33
A Formal Model of Async. Communicating IoT Devices
Asynchronously communicating objects: Natural model for IoT
• OO model structures programs in terms of classes and methods
• Active objects interact asynchronously w/o transfer of control
• Internal data structures in objects are captured by ADTs
• Active objects encapsulate a processor
• Implicit scheduling between processes inside an object
Object
STATE
E. B. Johnsen (U. of Oslo) Asynchronous Software Evolution ALP4IoT, 18.09.2017 14 / 33
Asynchronous Method Calls Decouple
Communication and Synchronization
• Objects communicate through method calls only
• Methods exported through interfaces (the types of objects)
• Asynchronous invocation: f := o!m(e)
• Polling for method result: await f?
• Reading the result: x := f.get()
• Guarded invocations: f := o!m(e); . . . ; await f?; x := f.get()
• Self calls may also be asynchronous / guarded
• In order to increase execution flexibility,
polling may cause process suspension
E. B. Johnsen (U. of Oslo) Asynchronous Software Evolution ALP4IoT, 18.09.2017 15 / 33
Cooperative Concurrency
• Process: code + local variable bindings (method activation)
• Object: state + active process + suspended processes
• Suspension by statement await guard
• Guards are combinations of:
- f? ∈ Guard, where f : Fut⟨T⟩
- e ∈ Guard, where e : Bool
• If guard g evaluates to false the active process is suspended
• If no process is active, any suspended process may be
activated if its guard evaluates to true.
• Inner guards enable interleaving of active and reactive code
E. B. Johnsen (U. of Oslo) Asynchronous Software Evolution ALP4IoT, 18.09.2017 16 / 33
Syntax for Active Object Calculus
P ::= D L {T x; sr}
D ::= interface I extends I {Ms}
T ::= I | Bool | . . . | Fut⟨T⟩
L ::= class C extends C implements I {T f; M}
M ::= Ms{T x; sr}
Ms ::= T m (T x)
sr ::= s; return e
s ::= v := e | await g | skip | s; s | if e then s else s fi | release
e ::= v | new C( ) | e.get | e!m(e) | . . .
g ::= e | v? | g ∧ g
v ::= f | x
Note that interfaces are the types of objects, and that
code is structured in a class hierarchy of method definitions
(We here ignore ADTs…)
E. B. Johnsen (U. of Oslo) Asynchronous Software Evolution ALP4IoT, 18.09.2017 17 / 33
Example: A Bank Account
class BankAccount implements Account {
Int bal := 0, Fut⟨Bool⟩ f
Bool deposit (Nat sum) { bal := bal+sum; return true }
Bool transfer (Nat sum, Account acc) {
await bal ≥ sum ; bal := bal−sum; f := acc!deposit(sum); return true }
}
E. B. Johnsen (U. of Oslo) Asynchronous Software Evolution ALP4IoT, 18.09.2017 18 / 33
Typing
• Classes and interfaces will not be statically given
• Context Γ: interfaces ΓI, classes ΓC, variables Γv
• Context overriding: Γ + ∆ is Γ overridden by ∆
• Judgments Γ ⊢ s
(Var)
Γ(v) = T
Γ ⊢ v : T
(Get)
Γ ⊢ v : Fut⟨T⟩
Γ ⊢ v.get : T
(New)
∃T′
∈ interfaces(ΓC(C)) · T′
⪯ T
Γ ⊢ new C( ) : T
(Class)
∀I ∈ I · implements(C, I, Γ)
∀M ∈ M · Γ + [this→vC] + [attr(C, Γ)] ⊢ M
Γ ⊢ class C extends C implements I {T f; M}
Semantics & Type Safety
• SOS semantics for asynchronously communicating objects (e.g., ABS)
• No “method not understood” errors at runtime
[FMCO10]
E. B. Johnsen (U. of Oslo) Asynchronous Software Evolution ALP4IoT, 18.09.2017 19 / 33
Dynamic Classes
• Balance flexibility, ease of use, robustness
• A modular OO upgrade mechanism
• Asynchronous upgrades propagate
through the distributed system
• Modify class definitions at runtime
A class upgrade affects
• All future instances of the class
and its subclasses
• All existing instances of the class
and its subclasses
D
Network
A
B
C E
E. B. Johnsen (U. of Oslo) Asynchronous Software Evolution ALP4IoT, 18.09.2017 20 / 33
Upgrade Operations on Dynamic Classes
We consider the following class upgrade operations
U ::= new-class C extends C implements I {T f; M} Add new class
| new-interface I extends I {Ms} Add new interface
| update C extends C implements I {T f; M} Add interfaces, add/redefine code
| simplify C retract C {T f; M} Remove code
Challenges
• The timing of upgrade operations at runtime
• Recall: Interleaved execution of different processes in an object
• New processes must execute on the new state
• Old processes must execute on the old state
• Upgrade operations may depend on each other!
E. B. Johnsen (U. of Oslo) Asynchronous Software Evolution ALP4IoT, 18.09.2017 21 / 33
Example of a Class Upgrade: Bank Account
class BankAccount implements Account { - - Version 1
Int bal := 0, Fut⟨Int⟩ f
Bool deposit (Nat sum) { bal := bal+sum; return true }
Bool transfer (Nat sum, Account acc) {
await bal ≥ sum ; bal := bal−sum; f := acc!deposit(sum); return true }
}
update BankAccount extends ∅ implements BankerInt {
Nat overdraft := 0
Bool transfer (Nat sum, Account acc) {
await bal ≥ (sum−overdraft); bal := bal−sum; f := acc!deposit(sum); return true }
Bool setOverdraft (Nat max) { overdraft := max; return true }
}
The BankerInt interface exports the setOverdraft method
E. B. Johnsen (U. of Oslo) Asynchronous Software Evolution ALP4IoT, 18.09.2017 22 / 33
Example of a Class Upgrade: Bank Account
class BankAccount implements Account, BankerInt { - - Version 2
Int bal := 0, Fut⟨Int⟩ f, Nat overdraft := 0
Bool deposit (Nat sum) { bal := bal+sum; return true }
Bool transfer (Nat sum, Account acc) {
await bal ≥ (sum−overdraft); bal := bal−sum; f := acc!deposit(sum); return true }
Bool setOverdraft (Nat max) { overdraft := max; return true }
}
E. B. Johnsen (U. of Oslo) Asynchronous Software Evolution ALP4IoT, 18.09.2017 23 / 33
Typing w/ Dependency Effects
• Context extended with dependencies Γd (class name + version)
• Judgments Γ ⊢ s ⟨Σ⟩ where Σ is a set of dependencies
• [[v]] represents the dependency information for a variable v
(Var)
Γ(v) = T
Γ ⊢ v : T ⟨[[v]]⟩
(Get)
Γ ⊢ v : Fut⟨T⟩ ⟨Σ⟩
Γ ⊢ v.get : T ⟨Σ⟩
(New)
∃T′
∈ interfaces(ΓC(C)) · T′
⪯ T
Γ ⊢ new C( ) : T ⟨{⟨C, curr(C, Γ)}⟩
(Class)
∀I ∈ I · implements(C, I, Γ)
∀M ∈ M · Γ + [this→vC] + [attr(C, Γ)] ⊢ M ⟨ΣM
⟩
Γ + [⟨C, 0⟩→d
∪
M∈M ΣM
 {⟨C, 0⟩}]
⊢ class C extends C implements I {T f; M}
The effect system identifies all internal dependencies in a piece of code
E. B. Johnsen (U. of Oslo) Asynchronous Software Evolution ALP4IoT, 18.09.2017 24 / 33
Typing of Dynamic Class Constructs
• Sequence of typing contexts Γ0, Γ1, Γ2, . . .
• Γ0: context for the original program
• Syntax-driven construction of Γi+1 from Γi
(New-Class)
Γ′
= [C→C(C, I, T f, M)] ∀I ∈ I · implements(C, I, Γi
+ Γ′
)
C ̸∈ dom(Γi
C) ∀M ∈ M · Γi
+ Γ′
+ [this→vC] + [attr(C, Γi
+ Γ′
)] ⊢ M ⟨ΣM
⟩
Γi
+ Γ′
+ [⟨C, 1⟩→d
∪
M∈M ΣM
 {⟨C, 0⟩}]
⊢ new-class C extends C implements I {T f; M}
(Class-Update)
vs = curr(C, Γi
d) Γ′
= [C →C (C1; C2, I1; I2, (T1 f1; T2 f2), (M1 ⊕ M))]
Γi
C(C) = (C1, I1, T1 f1, M1)} refines(M, M1) ∀I ∈ I2 · implements(C, I, Γi
+ Γ′
)
∀M ∈ M · Γi
+ Γ′
+ [this→vC] + [attr(C, Γi
+ Γ′
)] ⊢ M ⟨ΣM
⟩
Γi
+ Γ′
+ [(C, vs + 1)→d
∪
M∈M ΣM
∪ {(C, vs)}]
⊢ update C extends C2 implements I2 {T2 f2; M}
E. B. Johnsen (U. of Oslo) Asynchronous Software Evolution ALP4IoT, 18.09.2017 25 / 33
Semantics for Dynamic Classes
The SOS semantics of the active object calculus consists of ∼20 rules
Rough idea of the extension for dynamic classes
• Upgrade messages are injected into the runtime configuration
• Messages propagate asynchronously
• Messages modify classes, then subclasses, then objects
• When to apply changes to objects: processor release!
• What about upgrades which depend on other upgrades?
Upgrade dependencies
• The static view of the system may differ from the runtime view
• Exploit the dependency mapping!
• Dependencies from the type analysis impose
runtime constraints on the application of upgrades
• Runtime constraints differ for the different upgrade operations
E. B. Johnsen (U. of Oslo) Asynchronous Software Evolution ALP4IoT, 18.09.2017 26 / 33
Type-Safe Upgrades
General case: Modify a class in a class hierarchy
Type correctness: Method binding
should still succeed!
• Add attributes, methods,
interfaces, superclasses
• Redefine methods
(subtyping discipline)
• Remove fields, methods
• Remove interfaces:
not supported
• Formal class parameters
may not be modified
Theorem. Dynamic class upgrades are type-safe
with the extended type system and semantics
[FM09]
E. B. Johnsen (U. of Oslo) Asynchronous Software Evolution ALP4IoT, 18.09.2017 27 / 33
Can We Go Beyond Type Safety?
Let us now assume that upgrades are well-typed,
what can we say about their effect on program behavior?
Behavioral Interfaces
• Natural to check that classes satisfy constraints of their interfaces
• Consider an assertion language to specify local constraints
• Assume now that interfaces associate pre/post-conditions to methods
• Let O ⊢ m : (p, q) express that O proves that (p, q) holds for method m
Soundness Conditions for a Class C Implementing Interfaces I
• For m in I, guarantees of m must entail associated interface constraints
• For external calls {r}v.m(){s}, (r, s) must follow from constraints of m in I
(where v : I)
• For local calls {r}m(){s}, (r, s) must follow from guarantees of m
[ISOLA12, JLAMP15]
E. B. Johnsen (U. of Oslo) Asynchronous Software Evolution ALP4IoT, 18.09.2017 28 / 33
Behavioral Reasoning About Adaptable Class Hierarchies
Working With Contexts
We will analyze a sequence of updates and associated analysis steps, and their
effect on a proof context
• P: current definitions of classes and interfaces
• U: unresolved proof obligations
• G(C, m): guarantees (with proof) for m in C
Soundness Invariant
• For each method m in I, guarantees of m must entail
associated constraints in I or I ⇝ m : (p, q) ∈ U(C)
• For external calls {r}v.m(){s} in proof of n, (r, s) must follow from
constraints of m in I (where v : I) or n ⇝ I : m : (r, s) ∈ U(C)
• For local calls {r}m(){s}, (r, s) must follow from guarantees of m or
n ⇝ m : (r, s) ∈ U(C)
Obviously, when U is empty, we are back to the standard setting
E. B. Johnsen (U. of Oslo) Asynchronous Software Evolution ALP4IoT, 18.09.2017 29 / 33
Invariant-Preserving Analysis
Building Blocks of a Proof System
Programs evolve by small changes to the class hierarchy, which can be
characterized by their effect on the proof context
• Add/remove class, add/remove field, add/remove/redefine method,
add/remove inheritance
• Add/remove interface, add/remove constraint, add/remove inheritance
Each change must preserve the soundness invariant!
Example
For newMtd(C, M):
empty G(C, m), remove M-triggered constraints from U,
add new constraints to U for C and for its subclasses
E. B. Johnsen (U. of Oslo) Asynchronous Software Evolution ALP4IoT, 18.09.2017 30 / 33
Levels of Modularity
Combining Steps
The class upgrade abstractions discussed earlier can be
defined in terms of these operations.
Example
modify C implements I {F;M} ==
newImpl(C, I) · newFld(C, F) · newMtd(C, M)
How Modular are the Different Operations?
Modularity level Adaptations
1. Class local newCls, newImpl
2. Class and subclasses newFld, remFld, newMtd, remMtd, setSup
3. Global – implements clause remInt, newConstr, newSup
4. Global – implementation remCls, remImpl, remConstr, remSup
E. B. Johnsen (U. of Oslo) Asynchronous Software Evolution ALP4IoT, 18.09.2017 31 / 33
Summary
Formal model of asynchronously evolving systems
• Active objects: natural model for IoT
• Dynamic classes: Modular and asynchronous runtime evolution
• Addresses mismatch between static and runtime views of system
by combining type analysis with runtime constraints
• Type safe asynchronous runtime evolution allows systems to evolve safely
• Need contexts to capture change (both for type and proof system)
IoT motivates interesting research problems in PL/FM
• IoT can be “more than gateways”
• Asynchronous software evolution and types
• Behavioral reasoning and evolution
• Behavioral reasoning and information hiding
E. B. Johnsen (U. of Oslo) Asynchronous Software Evolution ALP4IoT, 18.09.2017 32 / 33
References
Here are references to our work discussed in this talk:
[FMCO10] E. B. Johnsen, R. Hähnle, J. Schäfer, R. Schlatte, M. Steffen, ABS: A Core Language for
Abstract Behavioral Specification. Proc. 9th Intl. Symp. on Formal Methods for Components and Objects
(FMCO 2010), LNCS 6957, Springer 2011.
http://einarj.at.ifi.uio.no/Papers/johnsen10fmco.pdf
[FM09] E. B. Johnsen, M. Kyas, I. C. Yu, Dynamic Classes: Modular Asynchronous Evolution of Distributed
Concurrent Objects. Proc. 16th Intl. Symp. on Formal Methods (FM’09), LNCS 5850, Springer 2009.
http://einarj.at.ifi.uio.no/Papers/johnsen09fm.pdf
[ISOLA12] J. Dovland, E. B. Johnsen, I. C. Yu, Tracking Behavioral Constraints during Object-Oriented
Software Evolution. Proc. Intl. Symp. on Leveraging Applications (ISoLA’12), LNCS 7609, Springer 2012.
http://einarj.at.ifi.uio.no/Papers/dovland12isola.pdf
[JLAMP15] J. Dovland, E. B. Johnsen, O. Owe, I. C. Yu, A proof system for adaptable class hierarchies.
J. Log. Algebr. Meth. Program. 84 (1): 37–53, 2015.
https://doi.org/10.1016/j.jlamp.2014.09.001
See these papers for a thorough discussion of related work.
E. B. Johnsen (U. of Oslo) Asynchronous Software Evolution ALP4IoT, 18.09.2017 33 / 33

Contenu connexe

Dernier

%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park masabamasaba
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024Mind IT Systems
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionOnePlan Solutions
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfonteinmasabamasaba
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyviewmasabamasaba
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park masabamasaba
 
%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg
%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg
%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburgmasabamasaba
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfonteinmasabamasaba
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastPapp Krisztián
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfproinshot.com
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesVictorSzoltysek
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...masabamasaba
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...masabamasaba
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...masabamasaba
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...SelfMade bd
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 

Dernier (20)

%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg
%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg
%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 

En vedette

Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at WorkGetSmarter
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...DevGAMM Conference
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationErica Santiago
 
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellGood Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellSaba Software
 

En vedette (20)

Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy Presentation
 
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellGood Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
 

Asynchronous Software Evolution: Obtaining Type Safety by Combining Type Checking and Runtime Constraints

  • 1. Asynchronous Software Evolution: Obtaining Type Safety by Combining Type Checking and Runtime Constraints Einar Broch Johnsen (joint work with Ingrid Chieh Yu and others) University of Oslo, Norway einarj@ifi.uio.no 1st workshop on Architectures, Languages and Paradigms for IoT (ALP4IoT) Torino, 18 September 2017 http://www.sirius-labs.no
  • 2. What Do We Want To Talk About Today? [Wikipedia]The Internet of Things • Connected physical devices (also called “smart devices”) with embedded software, sensors, and actuators, which collect and exchange data • Applications: Environmental monitoring, infrastructure management, manufacturing, agriculture, energy management, medical and healthcare, building and home automation, … • Currently, IoT has a strong engineering focus: IoT gateways connect IoT devices and the cloud Talk Overview • Quick, informal intro to home automation • Software evolution for asynchronous, loosely coupled systems • Programming abstractions, typing, and behavioral reasoning E. B. Johnsen (U. of Oslo) Asynchronous Software Evolution ALP4IoT, 18.09.2017 1 / 33
  • 3. Connected, Smart Things Whirlpool’s $1,699 “smart” washing machine boasts Wi-Fi and a colored control screen, can be started from an iPhone app, and will text or email you when your clothes are ready to dry (hopefully you dry them in a “smart” dryer). But if you wonder who would want to buy an Internet-enabled washing machine, you’re not alone. Even Whirlpool’s not so sure. “We’re a little bit of a hammer looking for a nail right now,” said Chris Quatrochi, Whirlpool’s global director of user experi- ence and connectivity. The buyers of web- connected washers, more than a year after launch, are still “not at all widespread,” he said. “Trying to understand exactly the value proposition that you provide to the consumer has been a little bit of a challenge.” (Washington Post, October 28, 2014) Can we help Mr Quatrochi with some ideas? E. B. Johnsen (U. of Oslo) Asynchronous Software Evolution ALP4IoT, 18.09.2017 2 / 33
  • 4. Woolen Smart Things “Smart Socks translate proven science into a design that fits easily into your everyday life.” All you have to do is put on socks like you would every day. The temperature sensors are integrated into the fabric of the sock, and the data is sent to your phone app. Smart Socks are smart machine washable, smart machine dryable, and do not need to be charged. But how can the smart socks get to the washing machine? E. B. Johnsen (U. of Oslo) Asynchronous Software Evolution ALP4IoT, 18.09.2017 3 / 33
  • 5. Smart Implants “Let us connect the smart socks and the smart washing machine to a controllable host, which can act as our mule” (Image MIT) E. B. Johnsen (U. of Oslo) Asynchronous Software Evolution ALP4IoT, 18.09.2017 4 / 33
  • 6. Microprocessor Knees (Images Össur) Software upgrades propagatevia bluetooth to the MPKs! E. B. Johnsen (U. of Oslo) Asynchronous Software Evolution ALP4IoT, 18.09.2017 5 / 33
  • 7. Software Evolution in IoT Distributed system of loosely connected running software that needs to be maintained E. B. Johnsen (U. of Oslo) Asynchronous Software Evolution ALP4IoT, 18.09.2017 6 / 33
  • 8. Runtime Software Evolution Different devices need maintenance • Distributed system of loosely coupled devices • Overall functionality depends on how the devices interact Traditional solution to software upgrades • Halt overall system behavior, recompile, restart • Difficult to achieve in IoT setting Need automated, non-halting solution E. B. Johnsen (U. of Oslo) Asynchronous Software Evolution ALP4IoT, 18.09.2017 7 / 33
  • 9. DSU: Dynamic Software Updating DSU : Techniques to update a running program Existing approaches in practice • Barrier solutions All existing instances must have expired • Passive partitioning Multiple coexisting versions C++, AspectJ • Global update / hot-swapping dist. obj. databases, Java • Asynchronous global Erlang E. B. Johnsen (U. of Oslo) Asynchronous Software Evolution ALP4IoT, 18.09.2017 8 / 33
  • 10. DSU: Dynamic Software Updating DSU : Techniques to update a running program Related formal models • Imperative: C, barrier, single threaded, explicit primitive • Object-oriented: AspectJ, passive partitioning, multiple versions, explicit primitive • Module linking • Reclassification E. B. Johnsen (U. of Oslo) Asynchronous Software Evolution ALP4IoT, 18.09.2017 9 / 33
  • 11. What Could Possibly Go Wrong? In the asynchronous setting, DSU can introduce races between regular execution and code evolution Target CallerDSU Add method m() Call to m() Local upgrades can happen too late Example: Call to a new method, but it is not yet available E. B. Johnsen (U. of Oslo) Asynchronous Software Evolution ALP4IoT, 18.09.2017 10 / 33
  • 12. What Could Possibly Go Wrong? In the asynchronous setting, DSU can introduce races between regular execution and code evolution Target CallerDSU Remove method m() Call to m() Local upgrades can happen too early Example: Call to an old method, but it has been removed E. B. Johnsen (U. of Oslo) Asynchronous Software Evolution ALP4IoT, 18.09.2017 11 / 33
  • 13. What Could Possibly Go Wrong? In the asynchronous setting, DSU can introduce races between regular execution and code evolution Target CallerDSU Remove method m() Call to m() Local upgrades can happen too early Example: Call to an old method, but it has been removed Target DSU Add method m() DSU Call method m() Upgrades can depend on other (delayed) upgrades Example: An upgrade may call a method in another upgrade E. B. Johnsen (U. of Oslo) Asynchronous Software Evolution ALP4IoT, 18.09.2017 12 / 33
  • 14. Asynchronous DSU: The Allegory of the Cave Static vs. runtime view • We want to statically eliminate such runtime errors • …but we don’t know what has happened (so far) at runtime • Mismatch between static and runtime view of the code Technical part of talk coming up • Formal approach to async. runtime evolution • Dynamic class calculus for active objects • Ensure that method binding succeeds when programs asynchronously evolve E. B. Johnsen (U. of Oslo) Asynchronous Software Evolution ALP4IoT, 18.09.2017 13 / 33
  • 15. A Formal Model of Async. Communicating IoT Devices Asynchronously communicating objects: Natural model for IoT • OO model structures programs in terms of classes and methods • Active objects interact asynchronously w/o transfer of control • Internal data structures in objects are captured by ADTs • Active objects encapsulate a processor • Implicit scheduling between processes inside an object Object STATE E. B. Johnsen (U. of Oslo) Asynchronous Software Evolution ALP4IoT, 18.09.2017 14 / 33
  • 16. Asynchronous Method Calls Decouple Communication and Synchronization • Objects communicate through method calls only • Methods exported through interfaces (the types of objects) • Asynchronous invocation: f := o!m(e) • Polling for method result: await f? • Reading the result: x := f.get() • Guarded invocations: f := o!m(e); . . . ; await f?; x := f.get() • Self calls may also be asynchronous / guarded • In order to increase execution flexibility, polling may cause process suspension E. B. Johnsen (U. of Oslo) Asynchronous Software Evolution ALP4IoT, 18.09.2017 15 / 33
  • 17. Cooperative Concurrency • Process: code + local variable bindings (method activation) • Object: state + active process + suspended processes • Suspension by statement await guard • Guards are combinations of: - f? ∈ Guard, where f : Fut⟨T⟩ - e ∈ Guard, where e : Bool • If guard g evaluates to false the active process is suspended • If no process is active, any suspended process may be activated if its guard evaluates to true. • Inner guards enable interleaving of active and reactive code E. B. Johnsen (U. of Oslo) Asynchronous Software Evolution ALP4IoT, 18.09.2017 16 / 33
  • 18. Syntax for Active Object Calculus P ::= D L {T x; sr} D ::= interface I extends I {Ms} T ::= I | Bool | . . . | Fut⟨T⟩ L ::= class C extends C implements I {T f; M} M ::= Ms{T x; sr} Ms ::= T m (T x) sr ::= s; return e s ::= v := e | await g | skip | s; s | if e then s else s fi | release e ::= v | new C( ) | e.get | e!m(e) | . . . g ::= e | v? | g ∧ g v ::= f | x Note that interfaces are the types of objects, and that code is structured in a class hierarchy of method definitions (We here ignore ADTs…) E. B. Johnsen (U. of Oslo) Asynchronous Software Evolution ALP4IoT, 18.09.2017 17 / 33
  • 19. Example: A Bank Account class BankAccount implements Account { Int bal := 0, Fut⟨Bool⟩ f Bool deposit (Nat sum) { bal := bal+sum; return true } Bool transfer (Nat sum, Account acc) { await bal ≥ sum ; bal := bal−sum; f := acc!deposit(sum); return true } } E. B. Johnsen (U. of Oslo) Asynchronous Software Evolution ALP4IoT, 18.09.2017 18 / 33
  • 20. Typing • Classes and interfaces will not be statically given • Context Γ: interfaces ΓI, classes ΓC, variables Γv • Context overriding: Γ + ∆ is Γ overridden by ∆ • Judgments Γ ⊢ s (Var) Γ(v) = T Γ ⊢ v : T (Get) Γ ⊢ v : Fut⟨T⟩ Γ ⊢ v.get : T (New) ∃T′ ∈ interfaces(ΓC(C)) · T′ ⪯ T Γ ⊢ new C( ) : T (Class) ∀I ∈ I · implements(C, I, Γ) ∀M ∈ M · Γ + [this→vC] + [attr(C, Γ)] ⊢ M Γ ⊢ class C extends C implements I {T f; M} Semantics & Type Safety • SOS semantics for asynchronously communicating objects (e.g., ABS) • No “method not understood” errors at runtime [FMCO10] E. B. Johnsen (U. of Oslo) Asynchronous Software Evolution ALP4IoT, 18.09.2017 19 / 33
  • 21. Dynamic Classes • Balance flexibility, ease of use, robustness • A modular OO upgrade mechanism • Asynchronous upgrades propagate through the distributed system • Modify class definitions at runtime A class upgrade affects • All future instances of the class and its subclasses • All existing instances of the class and its subclasses D Network A B C E E. B. Johnsen (U. of Oslo) Asynchronous Software Evolution ALP4IoT, 18.09.2017 20 / 33
  • 22. Upgrade Operations on Dynamic Classes We consider the following class upgrade operations U ::= new-class C extends C implements I {T f; M} Add new class | new-interface I extends I {Ms} Add new interface | update C extends C implements I {T f; M} Add interfaces, add/redefine code | simplify C retract C {T f; M} Remove code Challenges • The timing of upgrade operations at runtime • Recall: Interleaved execution of different processes in an object • New processes must execute on the new state • Old processes must execute on the old state • Upgrade operations may depend on each other! E. B. Johnsen (U. of Oslo) Asynchronous Software Evolution ALP4IoT, 18.09.2017 21 / 33
  • 23. Example of a Class Upgrade: Bank Account class BankAccount implements Account { - - Version 1 Int bal := 0, Fut⟨Int⟩ f Bool deposit (Nat sum) { bal := bal+sum; return true } Bool transfer (Nat sum, Account acc) { await bal ≥ sum ; bal := bal−sum; f := acc!deposit(sum); return true } } update BankAccount extends ∅ implements BankerInt { Nat overdraft := 0 Bool transfer (Nat sum, Account acc) { await bal ≥ (sum−overdraft); bal := bal−sum; f := acc!deposit(sum); return true } Bool setOverdraft (Nat max) { overdraft := max; return true } } The BankerInt interface exports the setOverdraft method E. B. Johnsen (U. of Oslo) Asynchronous Software Evolution ALP4IoT, 18.09.2017 22 / 33
  • 24. Example of a Class Upgrade: Bank Account class BankAccount implements Account, BankerInt { - - Version 2 Int bal := 0, Fut⟨Int⟩ f, Nat overdraft := 0 Bool deposit (Nat sum) { bal := bal+sum; return true } Bool transfer (Nat sum, Account acc) { await bal ≥ (sum−overdraft); bal := bal−sum; f := acc!deposit(sum); return true } Bool setOverdraft (Nat max) { overdraft := max; return true } } E. B. Johnsen (U. of Oslo) Asynchronous Software Evolution ALP4IoT, 18.09.2017 23 / 33
  • 25. Typing w/ Dependency Effects • Context extended with dependencies Γd (class name + version) • Judgments Γ ⊢ s ⟨Σ⟩ where Σ is a set of dependencies • [[v]] represents the dependency information for a variable v (Var) Γ(v) = T Γ ⊢ v : T ⟨[[v]]⟩ (Get) Γ ⊢ v : Fut⟨T⟩ ⟨Σ⟩ Γ ⊢ v.get : T ⟨Σ⟩ (New) ∃T′ ∈ interfaces(ΓC(C)) · T′ ⪯ T Γ ⊢ new C( ) : T ⟨{⟨C, curr(C, Γ)}⟩ (Class) ∀I ∈ I · implements(C, I, Γ) ∀M ∈ M · Γ + [this→vC] + [attr(C, Γ)] ⊢ M ⟨ΣM ⟩ Γ + [⟨C, 0⟩→d ∪ M∈M ΣM {⟨C, 0⟩}] ⊢ class C extends C implements I {T f; M} The effect system identifies all internal dependencies in a piece of code E. B. Johnsen (U. of Oslo) Asynchronous Software Evolution ALP4IoT, 18.09.2017 24 / 33
  • 26. Typing of Dynamic Class Constructs • Sequence of typing contexts Γ0, Γ1, Γ2, . . . • Γ0: context for the original program • Syntax-driven construction of Γi+1 from Γi (New-Class) Γ′ = [C→C(C, I, T f, M)] ∀I ∈ I · implements(C, I, Γi + Γ′ ) C ̸∈ dom(Γi C) ∀M ∈ M · Γi + Γ′ + [this→vC] + [attr(C, Γi + Γ′ )] ⊢ M ⟨ΣM ⟩ Γi + Γ′ + [⟨C, 1⟩→d ∪ M∈M ΣM {⟨C, 0⟩}] ⊢ new-class C extends C implements I {T f; M} (Class-Update) vs = curr(C, Γi d) Γ′ = [C →C (C1; C2, I1; I2, (T1 f1; T2 f2), (M1 ⊕ M))] Γi C(C) = (C1, I1, T1 f1, M1)} refines(M, M1) ∀I ∈ I2 · implements(C, I, Γi + Γ′ ) ∀M ∈ M · Γi + Γ′ + [this→vC] + [attr(C, Γi + Γ′ )] ⊢ M ⟨ΣM ⟩ Γi + Γ′ + [(C, vs + 1)→d ∪ M∈M ΣM ∪ {(C, vs)}] ⊢ update C extends C2 implements I2 {T2 f2; M} E. B. Johnsen (U. of Oslo) Asynchronous Software Evolution ALP4IoT, 18.09.2017 25 / 33
  • 27. Semantics for Dynamic Classes The SOS semantics of the active object calculus consists of ∼20 rules Rough idea of the extension for dynamic classes • Upgrade messages are injected into the runtime configuration • Messages propagate asynchronously • Messages modify classes, then subclasses, then objects • When to apply changes to objects: processor release! • What about upgrades which depend on other upgrades? Upgrade dependencies • The static view of the system may differ from the runtime view • Exploit the dependency mapping! • Dependencies from the type analysis impose runtime constraints on the application of upgrades • Runtime constraints differ for the different upgrade operations E. B. Johnsen (U. of Oslo) Asynchronous Software Evolution ALP4IoT, 18.09.2017 26 / 33
  • 28. Type-Safe Upgrades General case: Modify a class in a class hierarchy Type correctness: Method binding should still succeed! • Add attributes, methods, interfaces, superclasses • Redefine methods (subtyping discipline) • Remove fields, methods • Remove interfaces: not supported • Formal class parameters may not be modified Theorem. Dynamic class upgrades are type-safe with the extended type system and semantics [FM09] E. B. Johnsen (U. of Oslo) Asynchronous Software Evolution ALP4IoT, 18.09.2017 27 / 33
  • 29. Can We Go Beyond Type Safety? Let us now assume that upgrades are well-typed, what can we say about their effect on program behavior? Behavioral Interfaces • Natural to check that classes satisfy constraints of their interfaces • Consider an assertion language to specify local constraints • Assume now that interfaces associate pre/post-conditions to methods • Let O ⊢ m : (p, q) express that O proves that (p, q) holds for method m Soundness Conditions for a Class C Implementing Interfaces I • For m in I, guarantees of m must entail associated interface constraints • For external calls {r}v.m(){s}, (r, s) must follow from constraints of m in I (where v : I) • For local calls {r}m(){s}, (r, s) must follow from guarantees of m [ISOLA12, JLAMP15] E. B. Johnsen (U. of Oslo) Asynchronous Software Evolution ALP4IoT, 18.09.2017 28 / 33
  • 30. Behavioral Reasoning About Adaptable Class Hierarchies Working With Contexts We will analyze a sequence of updates and associated analysis steps, and their effect on a proof context • P: current definitions of classes and interfaces • U: unresolved proof obligations • G(C, m): guarantees (with proof) for m in C Soundness Invariant • For each method m in I, guarantees of m must entail associated constraints in I or I ⇝ m : (p, q) ∈ U(C) • For external calls {r}v.m(){s} in proof of n, (r, s) must follow from constraints of m in I (where v : I) or n ⇝ I : m : (r, s) ∈ U(C) • For local calls {r}m(){s}, (r, s) must follow from guarantees of m or n ⇝ m : (r, s) ∈ U(C) Obviously, when U is empty, we are back to the standard setting E. B. Johnsen (U. of Oslo) Asynchronous Software Evolution ALP4IoT, 18.09.2017 29 / 33
  • 31. Invariant-Preserving Analysis Building Blocks of a Proof System Programs evolve by small changes to the class hierarchy, which can be characterized by their effect on the proof context • Add/remove class, add/remove field, add/remove/redefine method, add/remove inheritance • Add/remove interface, add/remove constraint, add/remove inheritance Each change must preserve the soundness invariant! Example For newMtd(C, M): empty G(C, m), remove M-triggered constraints from U, add new constraints to U for C and for its subclasses E. B. Johnsen (U. of Oslo) Asynchronous Software Evolution ALP4IoT, 18.09.2017 30 / 33
  • 32. Levels of Modularity Combining Steps The class upgrade abstractions discussed earlier can be defined in terms of these operations. Example modify C implements I {F;M} == newImpl(C, I) · newFld(C, F) · newMtd(C, M) How Modular are the Different Operations? Modularity level Adaptations 1. Class local newCls, newImpl 2. Class and subclasses newFld, remFld, newMtd, remMtd, setSup 3. Global – implements clause remInt, newConstr, newSup 4. Global – implementation remCls, remImpl, remConstr, remSup E. B. Johnsen (U. of Oslo) Asynchronous Software Evolution ALP4IoT, 18.09.2017 31 / 33
  • 33. Summary Formal model of asynchronously evolving systems • Active objects: natural model for IoT • Dynamic classes: Modular and asynchronous runtime evolution • Addresses mismatch between static and runtime views of system by combining type analysis with runtime constraints • Type safe asynchronous runtime evolution allows systems to evolve safely • Need contexts to capture change (both for type and proof system) IoT motivates interesting research problems in PL/FM • IoT can be “more than gateways” • Asynchronous software evolution and types • Behavioral reasoning and evolution • Behavioral reasoning and information hiding E. B. Johnsen (U. of Oslo) Asynchronous Software Evolution ALP4IoT, 18.09.2017 32 / 33
  • 34. References Here are references to our work discussed in this talk: [FMCO10] E. B. Johnsen, R. Hähnle, J. Schäfer, R. Schlatte, M. Steffen, ABS: A Core Language for Abstract Behavioral Specification. Proc. 9th Intl. Symp. on Formal Methods for Components and Objects (FMCO 2010), LNCS 6957, Springer 2011. http://einarj.at.ifi.uio.no/Papers/johnsen10fmco.pdf [FM09] E. B. Johnsen, M. Kyas, I. C. Yu, Dynamic Classes: Modular Asynchronous Evolution of Distributed Concurrent Objects. Proc. 16th Intl. Symp. on Formal Methods (FM’09), LNCS 5850, Springer 2009. http://einarj.at.ifi.uio.no/Papers/johnsen09fm.pdf [ISOLA12] J. Dovland, E. B. Johnsen, I. C. Yu, Tracking Behavioral Constraints during Object-Oriented Software Evolution. Proc. Intl. Symp. on Leveraging Applications (ISoLA’12), LNCS 7609, Springer 2012. http://einarj.at.ifi.uio.no/Papers/dovland12isola.pdf [JLAMP15] J. Dovland, E. B. Johnsen, O. Owe, I. C. Yu, A proof system for adaptable class hierarchies. J. Log. Algebr. Meth. Program. 84 (1): 37–53, 2015. https://doi.org/10.1016/j.jlamp.2014.09.001 See these papers for a thorough discussion of related work. E. B. Johnsen (U. of Oslo) Asynchronous Software Evolution ALP4IoT, 18.09.2017 33 / 33