About Dynamic Classes in CREOL - PowerPoint PPT Presentation

1 / 29
About This Presentation
Title:

About Dynamic Classes in CREOL

Description:

Einar Broch Johnsen and Olaf Owe, Univ. Oslo. 2. CREOL 'A formal framework for reflective component modelling' ... 'to develop a formal framework and tool. for ... – PowerPoint PPT presentation

Number of Views:50
Avg rating:3.0/5.0
Slides: 30
Provided by: isabelles
Category:
Tags: creol | broch | classes | dynamic

less

Transcript and Presenter's Notes

Title: About Dynamic Classes in CREOL


1
About Dynamic Classes in CREOL
  • Isabelle Simplot-Ryl, Univ. Lille
  • on-going work with
  • Einar Broch Johnsen and Olaf Owe, Univ. Oslo

2
CREOL
  • A formal framework for reflective component
    modelling
  • Project of the Precise Modelling and Analysis
    Group (dep. of inf., Univ. Olso)
  • Goal

to develop a formal framework and tool for
reasoning about dynamic and reflective
modifications in object-oriented open
distributed systems, ensuring reliability and
correctness of the overall system.
3
CreolConcurrent Reflective Object-oriented
Language
  • Concurrent objects
  • having their own processor
  • passive activity in response to method
    invocations
  • active activity
  • Communications
  • synchronous method calls
  • asynchronous method calls
  • ? unified semantics

4
Classes
  • Attributes and methods are declared in classes
  • a run method is used to describe the active
    behaviour
  • Classes may have parameters
  • Classes may implement interfaces
  • ? we will not speak about interfaces in
    this context

5
Inheritance
  • Multiple inheritance of classes (and interfaces)
    is allowed
  • A class inherits a list of classes (with actual
    parameters if needed)
  • A class may redefine methods method search is a
    left-first depth-first search
  • Attribute names are statically (at compile time)
    expanded into qualified names so their are unique

6
Example 1
  • class RW
  • begin
  • var d Data 0
  • with Any
  • op write(in x Data) d x
  • op read(out x Data) x d
  • end

7
Method Invocation
  • Asynchronous invocation
  • t!o.m(exp) Invocation, the process continues its
    activity
  • t?(v) The process gets the return values,
    blocking statement
  • Synchronous invocation
  • o.m(expv) The processor is blocked while
    waiting for the reply
  • Local calls
  • without (or with) object identifier
  • static calls m_at_C(expv) or t!m_at_C(exp)

8
Guarded Statements
  • Composed with
  • (sequence), ? (or), (non-deterministic
    merge), (synchronized merge)
  • Guards
  • wait, t?, boolean expression, g1?g2, g1?g2
  • Assignments, if-constructs, recursive method
    calls,
  • Processor is released when a guard evaluates to
    false
  • When the processor is free enabled suspended
    processes must compete (except for local
    synchronous calls)

9
Example 2
  • class SSync
  • begin
  • var lock Oid null
  • with Any
  • op open await (lock null) lock
    caller
  • op close sync() lock null
  • op sync await (lock caller)
  • end

10
Example 3
  • class SRW inherits SSync, RW
  • begin
  • with Any
  • op write(in xData) sync_at_SSync()

  • write(x)_at_RW
  • op read(out xData) sync_at_Ssync()

  • read(x)_at_RW
  • end

11
Operational Semantics
  • Defined using rewriting logic (Maude imp.)
  • Creol objects and classes ? RL objects
  • ?Ob Cl,Pr,PrQ,Lvar,Att,Lab? and ?Cl
    Inh,Att,Mtds,Tok?
  • Method call ? pair of messages
  • invoc (o2,m,(t, o1, in)) and comp(t,o1,out)
  • A message queue per object ? RL object
  • The inheritance graph is not statically given

12
Operational Semantics (2)
  • Code loading
  • invoc (o2,m,(t, o1,in)) in the queue of o2C,
  • ? generation of bind(o2,m,(t ,o1, in),C)
  • Left-first depth-first exploration of the
    inheritance graph
  • Generation of a bound message containing a
    process with the method call and local state
  • Object creation new C(In)
  • Creation of a new object and a message queue
  • ? generation of a find message collecting and
    initializing the attributes in the inheritance
    tree in a left-first depth-first order
  • ? found message containing the initialized
    attributes

13
Dynamical Extension of Classes
  • Interest
  • Making systems evolve without stopping them
  • Correcting implementation bugs or design bugs
    without stopping the systems

14
Dynamical Extension of Classes
  • Goal
  • To change an existing class at runtime (by
    additions or redefinitions)
  • To see all the already existing objects of this
    class being extended (without any
    stop/creation/)
  • To see subclasses and objects of these subclasses
    being extended too

15
Class Extension
  • A class may be extended
  • Directly by
  • Addition of methods, attributes, and inherited
    classes
  • Method redefinition
  • Indirectly by
  • Extension of one of the classes of its
    inheritance graph

16
New Class Representation
  • To keep control of extensions, we need to know
  • Which version of a class an object is an instance
    of
  • Which version of a class another class inherits
  • use of a version number incremented
  • Each time a class is extended
  • Each time one of its direct super-classes is
    extended
  • ? ? CCl ? vsN, Inh(C1 N1 C2 N2 ), Att _,
    Mtds _, Tok_ ?

17
Direct Class Extension
  • New attributes may be added
  • New attributes cannot have the same name than
    other attributes already defined in the class
  • Because of the use of qualified names, new
    attributes may have the same names than inherited
    ones. Old methods will still use the old ones.
  • Methods may be added or upgraded
  • Inherited classes may be added but parameters of
    the class cannot change!

18
Direct Class Extension (2)
  • A new rule is added to the system to manage an
    add request
  • ?CCl vsN, InhI, AttA, MthsM, Tok_?
    add(C, I, A, M)
  • ?
  • ?CCl vsN1,InhI I,AttA A,MthsMM,Tok_?

19
Indirect Class Extension
  • Equation
  • ?CCl vsM, Inh S C N S,?
  • ? CCl vsN, ?
  • ? CCl vsM1, Inh S C N S, ?
  • ? CCl vsN, ?,
  • if N gt N

20
Advantages
  • The old version of the class is removed
  • The update propagations are locally managed
  • Concurrent extensions of a class The result may
    depend on the order in which extensions are
    performed
  • Concurrent extensions of super-classes of a class
    are possible

21
How does it work ?
  • After an extension of class C
  • New objects of class C are of the new class
  • Old objects must be updated
  • Object representation has to include the version
    number of the class the object is linked to
  • ? O Obj Cl C N, Pr _ , ?

22
Object Update
  • The binding mechanism is completely dynamic ? no
    problem
  • New attributes must be present when needed
  • The update must be performed as soon as possible
  • and before the next code loading update when
    Pr contains empty or continue

23
Object Update (2)
  • The version number is updated and a message is
    send to collect new attributes
  • Old attributes keep their values
  • New attributes are initialized using the current
    values of old attributes
  • No bound message must be received until the
    completion of the update
  • Advantages A class does not need to maintain a
    list of its instances, objects perform themselves
    their updates

24
Remarks
  • Updated objects may still have some old code in
    the process queue
  • As it is not possible to remove attributes, old
    code may be executed without any problem
  • Calls to redefined methods in old code are bound
    to new versions of methods
  • The use of recursivity instead of loops for
    non-terminating methods (like run) allows them to
    be updated while running

25
Example (4)
  • class MSync ---Version 0
  • begin
  • var lock OidSet empty
  • with Any
  • op open await (caller ? lock)
  • lock lock ? caller
  • op close sync() lock lock \ caller
  • op sync await (caller ? lock)
  • op waitFree await (lock empty)
  • end

26
Example (5)
  • class SSync --- Version 1
  • begin
  • var lock Oid null
  • with Any
  • op open waitFree() lock caller. ---
    upgrade
  • op close sync() lock null.
  • op sync await (lock caller).
  • op waitfree await (lock null). ---
    addition
  • end

27
Example (6)
  • SRW becomes Version 1

28
Example (7)
  • class SRW inherits SSync, RW, Msync --
    V2,V1,V0,V0
  • begin
  • var d Data 0
  • with Any
  • op open open_at_SSync() waitFree_at_MSync()
  • op close close_at_SSync()
  • op openM open_at_MSync() waitFree_at_SSync()
  • op closeM close_at_MSync()
  • op write(in xData) sync_at_SSync()
    write(x)_at_RW
  • op read (out xData) sync_at_SSync()
    sync_at_MSync()

  • read(x)_at_RW
  • end

29
Perspectives
  • Creol specifications are given in terms of
    communication traces
  • In a rely/guarantee style
  • Goal
  • To have to prove extensions
  • Not to have to re-prove anything else
Write a Comment
User Comments (0)
About PowerShow.com