15
Ac#veContext Erwann Wernli

ActiveContext

  • Upload
    esug

  • View
    378

  • Download
    0

Embed Size (px)

DESCRIPTION

ESUG 2011, Edinburgh

Citation preview

Page 1: ActiveContext

Ac#veContext  

Erwann  Wernli  

Page 2: ActiveContext

Outline  

• Why  dyn.  so:ware  update  is  challenging  (5’)  

•  Our  approach  (5’)  •  Current  stage  of  the  research  (5’)  

Page 3: ActiveContext

About  safety  

•  Let’s  consider  the  evolu#on  

Page  Html  

Page  Title  Body  

Page 4: ActiveContext

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

Trade-­‐offs  

prac#cal  

safe  

#mely  

Page 6: ActiveContext

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

Trade-­‐offs  

prac#cal  

safe  

#mely  

HotSwap  

Smalltalk  

Ginseng  

Boyapa#  

Dynamic  C++  

JVolve  

Gemstone  Ac#veContext  

FickleMT  

Page 8: ActiveContext

Our  approach  

    a  context        is  always  version-­‐consistent  

html := aPage html. ! newCtx := NewContext ancesor: oldCtx.! newCtx do: [ aPage header ,!! !! ! ! ! ! aPage body ].!

Page 9: ActiveContext

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
Page 11: ActiveContext

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

Conclusion  

•  First-­‐class  contexts  ensure  version  consistency  

•  Safe  dynamic  so:ware  update  

• Working  implementa#on  

•  Future  work:  enable  lazy  sync  &  GC  

Page 13: ActiveContext

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

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

Safety:  no  type  error,  no  func#onal  inconsistency  

Time:  quickly,  or  at  least,  eventually  install  the  update  

Prac-cality:  no  extra  constraint  during  development