1 / 18

Object-Oriented Implementation of Reconciliations

Explore reconciliations as a new approach in OOP, covering concurrency, shared memory models, reconciled fields, reconcilable classes, and Java language extensions. Understand how Java supports multithreading and synchronization for efficient data sharing.

sisto
Télécharger la présentation

Object-Oriented Implementation of Reconciliations

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Object-Oriented Implementation of Reconciliations M.Sc. Seminar Talkby Costa Shapiro under supervision of Prof. Shmuel Katz Computer Science –Technion

  2. Introduction • Concurrency implies information exchange • Convenient communication via data sharing • Various data sharing models and issues • Reconciliations as a new approach • Variables have “local” versions for each process • An operation on those versions to compute a “global” agreed version and distribute it • Means of control over participation of a particular version in such operations Reconciliations in OOP

  3. Outline • Background • Java Concurrency Support • Shared Memory Models • Concept And Programming Technique • Reconciled Fields • Reconcilable Classes • Language Extension And Usage • Patterns And Samples • Implementation Notes Reconciliations in OOP

  4. Java Concurrency Support • Java’s integrated multithreading support • Threads share the machine’s main memory • Built-in concurrent data access management and thread synchronization using monitors • Mutual exclusion language constructs • Suspension-notification mechanism • Flexible shared memory consistency model with a set of rules for synchronization Reconciliations in OOP

  5. Shared Memory Models • Linearizability & sequential consistency • Relaxed sequential consistency • Weaker rules for greater efficiency • Hybrid memory consistency models • Additional (synchronization) operations • Java’s shared memory model • “Regular” variables (weaker rules) • “Volatile” variables (stricter rules) • Implicit synchronization operations Reconciliations in OOP

  6. Reconciled Fields • Either a new kind of instance variables • Occasionally assigned an agreed “class-wide” value calculated separately • Can be guarded against such changes • Or a new kind of class variables • Having temporarily different “working” copies • Can be forced to get updated • Declared specially (in the extended language) • Can be seen as an additional (customizable) memory model for Java Reconciliations in OOP

  7. FieldInstance HiddenMechanism a1 class A x a2 reconciled x Reconciler A::x x a3 ReconciledField x x ClassInstance TemporarilyDetached Reconciled Fields (cont.) Reconciliations in OOP

  8. Reconcilable Classes • Reconcilability is a new addition to the possible class capabilities • Only reconcilable classes can be used to declare reconciled fields • Semantics of being reconcilable is identified by implementation of a special interface • Reconciliation mechanism has a default implementation that should be overridden • Means of iteration over the working copies • A “lightweight” precondition procedure Reconciliations in OOP

  9. class A a1 class X(reconcilable) ReconciliationOverride x x1 reconciliation reconciled X x a2 x x2 A::x Reconciler a3 x reconciliation x3 x FieldValue Reconcilable Classes (cont.) Reconciliations in OOP

  10. Java Language Extension • Reconciled fields: syntax • Variable declaration (a new reconciled modifier) • Variable “anti-reconciliation” guard options (a new localized statement and a method modifier) • Reconciled fields: semantics • Initialization (of “master and working copies”) • Reference, modification and assignment • “Localization” and “globalization” procedures • Reconciliations are as-if-atomic and independent Reconciliations in OOP

  11. Java Platform Changes • A new javax.reconciliation package • An Object class – replaces the java.lang.Object class and contains reconciliation-related methods • A Reconcilable interface – serves to identify the semantics of being reconcilable if implemented • A NotReconciledException class – thrown if a non-reconciled variable encountered • Some hidden (system) classes • An optional javax.reconciliation.util package contains utility framework Reconciliations in OOP

  12. Application Patterns • Customizable high-level caching • An arbitrary memory model can be realized • Distributed computation result reconciling • Independent computational agents are “improving” some global result • Weak and strong updates • Defer updates while performing work “locally” • Authorized commitment • Changes to some global data entity are reviewed by some authority prior to commitment Reconciliations in OOP

  13. Sample • Theglobalizemethod suspends the caller until a reconciliation of the field occurs • The reconcilemethod calculates the reconciled value (and updates this object) public class NetNode { public Date currentTime() { clock.globalize(); return clock.getTime(); } private reconciledLocalClockclk = new LocalClock(); } Reconciliations in OOP

  14. Sample (cont.) public class LocalClock implements Reconcilable { public localized void tick(long ticks) { localTime += ticks; } protected boolean reconcile(Collectionc) { Iteratori = c.iterator(); while (i.hasNext()) { LocalClocklc = (LocalClock)i.next(); if (lc.localTime > localTime) localTime = lc.localTime; } return true; } } Reconciliations in OOP

  15. Implementation Architecture Reconciliation-Enabled Java Source Code Preprocess Stage I Decorated Java Source Code Compilation Stage I Intermediate Java Class Binary Preprocess Stage II Standardized Java Source Code Compilation Stage II Java Class Binary Auxiliary Java Binary JVM Runtime Extended Platform Binary Reconciliations in OOP

  16. System Framework • The straightforward academic implementation is based on two new platform classes • javax.reconciliation.Object class • Serves as a new root of the class hierarchy • Has globalize methods & a reconciliation default • Contains “hidden” system fields and methods • javax.reconciliation.Reconciler abstract “hidden” system class • Reconciliation mechanism (synchronization, registration, etc) is implemented as its subclass Reconciliations in OOP

  17. a1 rx x rx.globalize(); a2 localized (x) { x x.globalize(); x = ...; a3 x = ...; rx.globalize(); x localized (x) { x.globalize(); x.foo(); x.globalize(); } Sample Runtime x1 x3 x2 Reconciliations in OOP

  18. Summary • A new object-oriented software engineering technique targeting common concurrent systems design issues and employing a programming language extension is proposed • The new technique is based on the reconciliations idea – a customizable shared memory consistency model • An academic implementation of the language extension has been built and working examples are supplied Reconciliations in OOP

More Related