Object-Oriented Implementation of Reconciliations M.Sc. Seminar Talk by Costa Shapiro under...
-
Upload
blaze-leonard -
Category
Documents
-
view
212 -
download
0
Transcript of Object-Oriented Implementation of Reconciliations M.Sc. Seminar Talk by Costa Shapiro under...
![Page 1: Object-Oriented Implementation of Reconciliations M.Sc. Seminar Talk by Costa Shapiro under supervision of Prof. Shmuel Katz Computer Science – Technion.](https://reader035.fdocuments.net/reader035/viewer/2022072013/56649e5c5503460f94b54df9/html5/thumbnails/1.jpg)
Object-Oriented Implementation of Reconciliations
M.Sc. Seminar Talkby Costa Shapiro
under supervision of Prof. Shmuel KatzComputer Science –Technion
![Page 2: Object-Oriented Implementation of Reconciliations M.Sc. Seminar Talk by Costa Shapiro under supervision of Prof. Shmuel Katz Computer Science – Technion.](https://reader035.fdocuments.net/reader035/viewer/2022072013/56649e5c5503460f94b54df9/html5/thumbnails/2.jpg)
29.01.2003 Reconciliations in OOP 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
![Page 3: Object-Oriented Implementation of Reconciliations M.Sc. Seminar Talk by Costa Shapiro under supervision of Prof. Shmuel Katz Computer Science – Technion.](https://reader035.fdocuments.net/reader035/viewer/2022072013/56649e5c5503460f94b54df9/html5/thumbnails/3.jpg)
29.01.2003 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
![Page 4: Object-Oriented Implementation of Reconciliations M.Sc. Seminar Talk by Costa Shapiro under supervision of Prof. Shmuel Katz Computer Science – Technion.](https://reader035.fdocuments.net/reader035/viewer/2022072013/56649e5c5503460f94b54df9/html5/thumbnails/4.jpg)
29.01.2003 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
![Page 5: Object-Oriented Implementation of Reconciliations M.Sc. Seminar Talk by Costa Shapiro under supervision of Prof. Shmuel Katz Computer Science – Technion.](https://reader035.fdocuments.net/reader035/viewer/2022072013/56649e5c5503460f94b54df9/html5/thumbnails/5.jpg)
29.01.2003 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
![Page 6: Object-Oriented Implementation of Reconciliations M.Sc. Seminar Talk by Costa Shapiro under supervision of Prof. Shmuel Katz Computer Science – Technion.](https://reader035.fdocuments.net/reader035/viewer/2022072013/56649e5c5503460f94b54df9/html5/thumbnails/6.jpg)
29.01.2003 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
![Page 7: Object-Oriented Implementation of Reconciliations M.Sc. Seminar Talk by Costa Shapiro under supervision of Prof. Shmuel Katz Computer Science – Technion.](https://reader035.fdocuments.net/reader035/viewer/2022072013/56649e5c5503460f94b54df9/html5/thumbnails/7.jpg)
29.01.2003 Reconciliations in OOP 7
Reconciler A::x
x
HiddenMechanism
Reconciled Fields (cont.)
class A
reconciled x
ReconciledField
TemporarilyDetached
a2
x
a1
x
FieldInstance
a3
x
ClassInstance
![Page 8: Object-Oriented Implementation of Reconciliations M.Sc. Seminar Talk by Costa Shapiro under supervision of Prof. Shmuel Katz Computer Science – Technion.](https://reader035.fdocuments.net/reader035/viewer/2022072013/56649e5c5503460f94b54df9/html5/thumbnails/8.jpg)
29.01.2003 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
![Page 9: Object-Oriented Implementation of Reconciliations M.Sc. Seminar Talk by Costa Shapiro under supervision of Prof. Shmuel Katz Computer Science – Technion.](https://reader035.fdocuments.net/reader035/viewer/2022072013/56649e5c5503460f94b54df9/html5/thumbnails/9.jpg)
29.01.2003 Reconciliations in OOP 9
class X(reconcilable)
reconciliation
ReconciliationOverride
A::x Reconciler
x
reconciliation
Reconcilable Classes (cont.)
class A
reconciled X x a2
x
x2
a1x
x1
a3x
x3
FieldValue
![Page 10: Object-Oriented Implementation of Reconciliations M.Sc. Seminar Talk by Costa Shapiro under supervision of Prof. Shmuel Katz Computer Science – Technion.](https://reader035.fdocuments.net/reader035/viewer/2022072013/56649e5c5503460f94b54df9/html5/thumbnails/10.jpg)
29.01.2003 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
![Page 11: Object-Oriented Implementation of Reconciliations M.Sc. Seminar Talk by Costa Shapiro under supervision of Prof. Shmuel Katz Computer Science – Technion.](https://reader035.fdocuments.net/reader035/viewer/2022072013/56649e5c5503460f94b54df9/html5/thumbnails/11.jpg)
29.01.2003 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
![Page 12: Object-Oriented Implementation of Reconciliations M.Sc. Seminar Talk by Costa Shapiro under supervision of Prof. Shmuel Katz Computer Science – Technion.](https://reader035.fdocuments.net/reader035/viewer/2022072013/56649e5c5503460f94b54df9/html5/thumbnails/12.jpg)
29.01.2003 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
![Page 13: Object-Oriented Implementation of Reconciliations M.Sc. Seminar Talk by Costa Shapiro under supervision of Prof. Shmuel Katz Computer Science – Technion.](https://reader035.fdocuments.net/reader035/viewer/2022072013/56649e5c5503460f94b54df9/html5/thumbnails/13.jpg)
29.01.2003 Reconciliations in OOP 13
Sample The globalize method suspends the caller until
a reconciliation of the field occurs The reconcile method calculates the
reconciled value (and updates this object)
public class NetNode { public Date currentTime() { clock.globalize(); return clock.getTime(); } private reconciled LocalClock clk = new LocalClock();}
![Page 14: Object-Oriented Implementation of Reconciliations M.Sc. Seminar Talk by Costa Shapiro under supervision of Prof. Shmuel Katz Computer Science – Technion.](https://reader035.fdocuments.net/reader035/viewer/2022072013/56649e5c5503460f94b54df9/html5/thumbnails/14.jpg)
29.01.2003 Reconciliations in OOP 14
Sample (cont.)public class LocalClock implements Reconcilable { public localized void tick(long ticks) { localTime += ticks; }
protected boolean reconcile(Collection c) { Iterator i = c.iterator(); while (i.hasNext()) { LocalClock lc = (LocalClock)i.next(); if (lc.localTime > localTime) localTime = lc.localTime; } return true; }}
![Page 15: Object-Oriented Implementation of Reconciliations M.Sc. Seminar Talk by Costa Shapiro under supervision of Prof. Shmuel Katz Computer Science – Technion.](https://reader035.fdocuments.net/reader035/viewer/2022072013/56649e5c5503460f94b54df9/html5/thumbnails/15.jpg)
29.01.2003 Reconciliations in OOP 15
Implementation Architecture
Reconciliation-Enabled Java Source Code
Decorated Java Source Code
Intermediate Java Class Binary
Standardized Java Source Code
Java Class Binary Auxiliary Java Binary
Preprocess Stage I
Preprocess Stage II
Compilation Stage I
Compilation Stage II
Extended Platform BinaryJVM Runtime
![Page 16: Object-Oriented Implementation of Reconciliations M.Sc. Seminar Talk by Costa Shapiro under supervision of Prof. Shmuel Katz Computer Science – Technion.](https://reader035.fdocuments.net/reader035/viewer/2022072013/56649e5c5503460f94b54df9/html5/thumbnails/16.jpg)
29.01.2003 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
![Page 17: Object-Oriented Implementation of Reconciliations M.Sc. Seminar Talk by Costa Shapiro under supervision of Prof. Shmuel Katz Computer Science – Technion.](https://reader035.fdocuments.net/reader035/viewer/2022072013/56649e5c5503460f94b54df9/html5/thumbnails/17.jpg)
29.01.2003 Reconciliations in OOP 17
x.globalize();
rx.globalize();
rx a2
x a3x
a1x
Sample Runtime
x2
x1
x3
localized (x) {
x = ...;x = ...; rx.globalize();
localized (x) {
x.globalize(); x.foo();
x.globalize();
}
![Page 18: Object-Oriented Implementation of Reconciliations M.Sc. Seminar Talk by Costa Shapiro under supervision of Prof. Shmuel Katz Computer Science – Technion.](https://reader035.fdocuments.net/reader035/viewer/2022072013/56649e5c5503460f94b54df9/html5/thumbnails/18.jpg)
29.01.2003 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