1 / 25

Synchronization of Distributed Objects

Synchronization of Distributed Objects. ICS280: Distributed System Middleware Xia Zhao xzhao@ics.uci.edu. Overview. Review of Object-Orientation & Actor Design goals and principles Single object: synchronization constraints Multiple objects: synchronizer Conclusion

ordell
Download Presentation

Synchronization of Distributed Objects

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. Synchronization of Distributed Objects ICS280: Distributed System Middleware Xia Zhao xzhao@ics.uci.edu

  2. Overview • Review of Object-Orientation & Actor • Design goals and principles • Single object: synchronization constraints • Multiple objects: synchronizer • Conclusion • Related work: Composition-Filters Model Synchronization of Distributed Objects

  3. Object Orientation Review • Object and Class • Interface and Encapsulation • Method and Message • Inheritance • Semantic inheritance: When A inherits B, A can be treated as B Synchronization of Distributed Objects

  4. Actor: underlying framework • Hewitt 1977, Agha 1986 • Asynchronous objects execute concurrently • Message passing: only inter-object communication • asynchronous: non-block • reliable: guaranteed to reach destination • arriving order may not be sending order • dispatch: message causes method execution • actor: one thread of control, no intra actor concurrency, one message queue Synchronization of Distributed Objects

  5. Synchronization • Definition: Ordered Message Dispatch • Synchronization: correct order • Two types of synchronization: • Shared Buffer: put/get, single object • Synchronization Constraints • Multimedia: audio/video, objects group • Synchronizer Synchronization of Distributed Objects

  6. Design Goals and Principles • A general construct, not a specific OOPL • Maintain encapsulation, enhance reuse: both objects and constraints • Separation of concerns • Single object: how vs. when • Object groups: entity vs. context • Language Support at both levels, in uniform way • Otherwise programmer need to invent the other Synchronization of Distributed Objects

  7. Single object: Synchronization Constraints • Separation of concerns: • methods specification: how • synchronization constraints: when • ease of reasoning • ease of modification: independent • ease of implementation: add constraints • integration with inheritance Synchronization of Distributed Objects

  8. Example: Bounded buffer • A shared buffer can hold at most max elements • A producer can put one element if buffer not full • A consumer can get one element if buffer not empty • Coordination can be implemented in producer and consumer • But it mixes how(functionality) and when(coordination), and compromises abstraction, modularity, reuse • So, buffer should be the center for coordination Synchronization of Distributed Objects

  9. Synchronization constraints: structure Object state Synchronization constraints Methods Message Dispatch Message Delivery Input queue Synchronization of Distributed Objects

  10. Synchronization Constraints: syntax / example • Syntax constraint ::= disablepattern1; …; patternk pattern ::= method(x1, …, xn) ifexp • Example class BoundedBuffer size := 0; disable put if size = MAX; get if size = 0; method put(item) … end put; method get(client) … end get; end BoundedBuffer; Synchronization of Distributed Objects

  11. Synchronization Constraints: inheritance • Constraints inheritance is different from method inheritance • Constraints inheritance enables incremental modification • Method: More stringent constraints • Example class Get2Buffer inherits BoundedBuffer disable get2 if size<=1; method get2(client)… end get2; end Get2Buffer; • Others are more complex: cancel, weaker • Ours: simple, practical(semantic inheritance) Synchronization of Distributed Objects

  12. Objects Group: Synchronizer • Separation of concerns • Individual objects’ encapsulation • Coordination constraints among them • Transparent • objects are not aware of coordinator • no explicit control exchange, just message observation • Ease of reasoning • Rely on interface, ease of encapsulation/modification/reuse • Composition and evolution Synchronization of Distributed Objects

  13. s constrain a constrain instantiate b constrain o c Synchronizer: structure • Observes and constrains • States • Trigger: message, action, state • Atomicity Constraints: mutual • Disabling Constraints: one way Synchronization of Distributed Objects

  14. Synchronizer: syntax Synchronizer name(par1,…,parn) vari := expi; relationj; end name; relation ::= trigger | constraint constraint ::= disable pattern | atomic(pattern1,…, patternn) trigger ::= trigger pattern-> actions pattern ::= object.method(name1,…,namen) if exp Synchronization of Distributed Objects

  15. Synchronizer: example1 Distributed Mutual Exclusion: RadioButton class Button synchronizer RB(buttons) isOn := false; activated := false; disablefor b in buttons: on if isOn; trigger off if not isOn; b.on -> {activated:=true;}; method on() … end on; b.off ->{activated:=false;}; method off() … end off; for b in buttons: end Button; disable b.on if activated end RB; Synchronization of Distributed Objects

  16. Synchronizer: Example2 Dinning Philosophers class Chopstick synchronizer indiv(c1,c2,phi) isPicked := false; atomic disable pickup if isPicked; (c1.pickup(p1) if p1=phi, method pickup(phil) c2.pickup(p2) if p2=phi); isPicked = true; … end indiv; end pickup; method drop() isPicked = false; … atomic: one message, one pattern end drop; atomic: different object, no undo end Chopstick Synchronization of Distributed Objects

  17. Synchronizer: composition • Composing Disabling and Atomicity Constraints synchronizer composed(o, p) disable o.m if exp; atomic(o.m, p.n); end composed; • Multiple synchronizers constrains one object • one chopstick is constrained by two synchronizers • Incremental Strengthening of Atomic Constraints Philosopher needs two chopsticks and one spoon strengthen indiv with (spoon.pickup(p3) if p3 = phil) Synchronization of Distributed Objects

  18. Synchronizer: Evaluation Order • Synchronizer and object: two-way • testing constraint, possibly dispatching, triggering state change: atomic • Different objects in atomic constraint • both m1 and m2 are to o, but m1 prevents m2 • Synchronization Constraints and Synchronizer • evaluating synchronization constraints, evaluating synchronizer constraints, dispatching message: atomic Synchronization of Distributed Objects

  19. (Not) Conclusion • Express message ordering constraints at high-level, object-oriented, and uniform manner • Synchronization constraints: part of object • when/how, inheritance • Synchronizer: separate entity • messages in group----atomic multicast: order; transaction: effect • synchronizer: user-specified order, supplementary • Separation of concern, abstraction, reuse Synchronization of Distributed Objects

  20. Composition-Filters Object Model A more elaborate and elegant model than traditional OOPL Synchronization of Distributed Objects

  21. Message Filters Using Message filters and internal objects to implement lots of functionality, including inheritance and delegation Synchronization of Distributed Objects

  22. Message Filter Types • Dispatch inputfilters disp : Dispatch = { inner.* }; • Abstract Communication Types(ACT) • Ordinary class, plus manipulating first-class representation of messages • Meta Filter Class: Message interactions are intercepted and transformed into first-class representations Synchronization of Distributed Objects

  23. Meta Filter Class Example: 1 class LoggedClerk interface comment "This is a subclass of clerk of which all the incoming and outgoing messages are logged by the external ACT object named bigBrother"; internals clerk : Clerk; // inherit from clerk externals bigBrother : LogACT; // an external ACT object inputfilters reifyIn : Meta = { [*.*]bigBrother.logMessage }; // reify and send message to the ACT inherit : Dispatch = { clerk.* }; outputfilters reifyOut : Meta = { [*.*]bigBrother.logMessage }; // reify and send message to the ACT end // class LoggedClerk interface Synchronization of Distributed Objects

  24. Meta Filter Class Example: 2 class LogACT interface methods logMessage(Message) returns Nil; inputfilters disp : Dispatch = {inner.* }; end; // class LogACT interface class LogACT implementation instvars log : OrderedCollection; methods logMessage(mess : Message) returns Nil begin log.addLast(mess); mess.fire; // Message Operations end; end; // class LogACT implementation Synchronization of Distributed Objects

  25. Comparison • With MAUD 1993 • MAUD also has a message interception mechanism, it requires development and replacement of some special classes. Composition-filter provides a general framework and several common solutions • With Frolund 1996 • Frolund’s solutions are more abstract, more modular. Composition-filter seems dealing with complex low-level features Synchronization of Distributed Objects

More Related