activecontext
DESCRIPTION
ESUG 2011, EdinburghTRANSCRIPT
![Page 1: ActiveContext](https://reader035.vdocument.in/reader035/viewer/2022062704/555bded1d8b42a38078b4882/html5/thumbnails/1.jpg)
Ac#veContext
Erwann Wernli
![Page 2: ActiveContext](https://reader035.vdocument.in/reader035/viewer/2022062704/555bded1d8b42a38078b4882/html5/thumbnails/2.jpg)
Outline
• Why dyn. so:ware update is challenging (5’)
• Our approach (5’) • Current stage of the research (5’)
![Page 3: ActiveContext](https://reader035.vdocument.in/reader035/viewer/2022062704/555bded1d8b42a38078b4882/html5/thumbnails/3.jpg)
About safety
• Let’s consider the evolu#on
Page Html
Page Title Body
![Page 4: ActiveContext](https://reader035.vdocument.in/reader035/viewer/2022062704/555bded1d8b42a38078b4882/html5/thumbnails/4.jpg)
About safety • How can we migrate the state?
• What happens if old running code accesses field html ?
• What if an execu#on mixes old and new code?
Method
Method
Method
…
aPage : Page
Request V1 Method
Method
Method
…
Request V2
html
Body / header
![Page 5: ActiveContext](https://reader035.vdocument.in/reader035/viewer/2022062704/555bded1d8b42a38078b4882/html5/thumbnails/5.jpg)
Trade-‐offs
prac#cal
safe
#mely
![Page 6: ActiveContext](https://reader035.vdocument.in/reader035/viewer/2022062704/555bded1d8b42a38078b4882/html5/thumbnails/6.jpg)
Trade-‐offs
prac#cal
safe
#mely
FickleMT
HotSwap
Smalltalk
Ginseng
Boyapa#
Dynamic C++
JVolve
Gemstone
Delay update Impose constraints
Run-‐8me errors
POLUS
![Page 7: ActiveContext](https://reader035.vdocument.in/reader035/viewer/2022062704/555bded1d8b42a38078b4882/html5/thumbnails/7.jpg)
Trade-‐offs
prac#cal
safe
#mely
HotSwap
Smalltalk
Ginseng
Boyapa#
Dynamic C++
JVolve
Gemstone Ac#veContext
FickleMT
![Page 8: ActiveContext](https://reader035.vdocument.in/reader035/viewer/2022062704/555bded1d8b42a38078b4882/html5/thumbnails/8.jpg)
Our approach
a context is always version-‐consistent
html := aPage html. ! newCtx := NewContext ancesor: oldCtx.! newCtx do: [ aPage header ,!! !! ! ! ! ! aPage body ].!
![Page 9: ActiveContext](https://reader035.vdocument.in/reader035/viewer/2022062704/555bded1d8b42a38078b4882/html5/thumbnails/9.jpg)
Request V1
…
Method
Method
Bi-‐direc#onal transforma#on
Shared object has one iden#ty but two states
Old con
text
aPage: Page
…
Method
Method
Request V2
Dynam
ic evolu#o
n
Solu#on: -‐ State transfer -‐ Safe concurrency -‐ Reflec#ve extension
![Page 10: ActiveContext](https://reader035.vdocument.in/reader035/viewer/2022062704/555bded1d8b42a38078b4882/html5/thumbnails/10.jpg)
![Page 11: ActiveContext](https://reader035.vdocument.in/reader035/viewer/2022062704/555bded1d8b42a38078b4882/html5/thumbnails/11.jpg)
Design
Strategy Instan#a#on Concurrent read/write
Garbage collec#on
Expected overhead
Eager Migrate objects
Sync on write Garbage when not used
High
Lazy Does nothing Sync on dirty read
Force migra#on prio to GC
Medium
![Page 12: ActiveContext](https://reader035.vdocument.in/reader035/viewer/2022062704/555bded1d8b42a38078b4882/html5/thumbnails/12.jpg)
Conclusion
• First-‐class contexts ensure version consistency
• Safe dynamic so:ware update
• Working implementa#on
• Future work: enable lazy sync & GC
![Page 13: ActiveContext](https://reader035.vdocument.in/reader035/viewer/2022062704/555bded1d8b42a38078b4882/html5/thumbnails/13.jpg)
Design
Contextual first-‐class classes Impact
yes Different versions are the same object Nice with inheritance Class-‐side variable synchronized
no Different name per context Not nice with inheritance Class-‐side variable not synchronized
![Page 14: ActiveContext](https://reader035.vdocument.in/reader035/viewer/2022062704/555bded1d8b42a38078b4882/html5/thumbnails/14.jpg)
Valida#on
• What about daemon threads?
• Can we evole class hierarchies this way? (interdependent classes,inheritance)
• Is the run-‐#me overhead acceptable? (in space & #me)
![Page 15: ActiveContext](https://reader035.vdocument.in/reader035/viewer/2022062704/555bded1d8b42a38078b4882/html5/thumbnails/15.jpg)
Safety: no type error, no func#onal inconsistency
Time: quickly, or at least, eventually install the update
Prac-cality: no extra constraint during development