180 likes | 347 Views
Distributed Shared Memory Using The .NET Framework. Thomas Seidmann Department of Computer Science and Engineering Faculty of Electrical Engineering and Information Technology Slovak University of Technology seidmann@dcs.elf.stuba.sk http://www.cdot.ch/thomas/.
E N D
Distributed Shared Memory Using The .NET Framework Thomas Seidmann Department of Computer Science and Engineering Faculty of Electrical Engineering and Information Technology Slovak University of Technology seidmann@dcs.elf.stuba.sk http://www.cdot.ch/thomas/
Building distributed applications with .NET (1) • (lower-level) socket programming • .NET Remoting • Web Services • Concentration on RPC-style client/server relationship • Remote access to shared objects (methods, properties) provided by a server (UDDI, manual discovery) Middleware for distributed objects
Node 1 Server Node 2
Building distributed applications with .NET (2) • Desired scenario: peer .NET applications collaborate on a set of shared objects • Replication of objects • Local access to methods (and properties) • Provide the notion of objects shared among peer .NET applications • Semantics of an object based DSM (Distributed Shared Memory) – coherence!
Node 1 Node 3 coherence protocol Node 2 Node 4
Consistency model and coherence protocol • Causal consistency model • Multiple Reader Multiple Writer (MRMW) • Write-update protocol • Multicast transfer of diffs between nodes • Causality relationship achieved by vector logical clocks - Associative array of pairs (PID, value) • Shared object identification with a GUID
DSM Implementation Outline • Mechanism for obtaining the state of a shared object • Registration of every change of a shared object in a local storage • Listening to changes made by remote nodes and to object state queries
DSM Implementation Outline • Mechanism for obtaining the state of a shared object serialization • Registration of every change of a shared object in a local storage interception • Listening to changes made by remote nodes and to object state queries coherence thread
Serialization, Interception • [serializable] • Binary serialization formatter • TransparentProxy • RealProxy DSMProxy • Method Entry: object diff storage cheched • Method Exit: diff calculated; if nonzero, then added with the vector logical clock value to the storage
Coherence Thread • Accesses object diff storage and the shared object via its DSMProxy • Performs state changes according to remote write update messages • Sends write update messages • Requests other nodes to send write update messages (new shared object, timeout)
Multicast Channel Service • Object diffs transported with .NET Remoting • Built-in channels are TCP-based • IP-Multicast uses UDP as transport protocol • UdpChannel, Implements IChannel
Programming Model for Shared Objects (1) • Descendant of ContextBoundObject • Must be serializable • Annotated with ProxyAttribute specifying McastDSM.DSMProxy • (State-Modifying public methods annoted with McastDSM.ModifiesStateAttribute)
Programming Model for Shared Objects (2) using System; using System.Runtime.Remoting; using System.Runtime.Remoting.Proxies; using McastDSM; [Proxy(DSMProxy)] [serializable] public class MySharedObject : ContextBoundObject, ISharedObject { private Guid myGuid = null; public Guid GuidProp { get {return myGuid;} set {myGuid = value;} } public int myMethod(string) { //... do something with string return 0; } }
Programming Model for Shared Objects (3) using System; using System.Runtime.Remoting; using System.Runtime.Remoting.Channels; using McastDSM; using McastDSM.Channels; public class App { public static int Main(string[] args) { ChannelServices.RegisterChannel ( new UdpChannel()); // Create an instance of a // MySharedObject class MySharedObject myObj = new MySharedObject; myObj.GuidProp = "478280B9-874E-4795-B3C7-05CFDD96CD2C"; myObj.myMethod("Hello World"); return 0; } }
Conclusions • 100% managed code, compatible with Rotor • Tested with well-known scientific applications (FFT-3D, Barnes Hut) • LAN environment, simulated loss of messages (trafic shaping with FreeBSD) • First focus on TRANSPARENCY • Comfortable programming model
Future Work • Second focus is on PERFORMANCE (diff calculation, message throughput) • Trade-off between transparency and performance • Other serialization formatters are being considered (SOAP) – might provide better diffs • SOAP together with XML aware compression (XMill)?
Thank you very much for your attention http://www.cdot.ch/thomas/