1 / 29

Formal dialogues

Formal dialogues. A new approach to remote object communication implemented as an extension to C# on ROTOR/.NET Raphael Güntensperger Jürg Gutknecht ETH Zürich. Agenda. Overview Concepts Model Implementation Development platform for tiny devices (outlook). Communication model

chione
Download Presentation

Formal dialogues

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. Formal dialogues A new approach to remote object communication implemented as an extension to C# on ROTOR/.NET Raphael Güntensperger Jürg Gutknecht ETH Zürich

  2. Agenda • Overview • Concepts • Model • Implementation • Development platform for tiny devices (outlook)

  3. Communication model Formal dialogues Syntactic integration in C# Development environment for small wearable devices Burn-down of programmed logic Overview Use .NET as a cross-development platform for programmed ‘wearable’ devices. 1. 2.

  4. Concept: Activity Concept: Channels Concepts • Motivation • Autonomous behavior of hardware objects • Independent activities • Asynchronous execution • Example: Clock • Rich interface to the environment • More than only a set of methods • Dialog-based interfaces • Objects have a status

  5. Concepts • A new model for remote objects • Active Objects (activities) • Formal Dialogues (channels) • Universal encoding of syntactic Tokens • No: RPC, RMI, IDL, Proxies, Marshalling • Optimal Support by C# and .NET runtime • Compiler integration • Small library (System.Channels)

  6. Concepts • Activities • Separate thread of control • Member of a class • Started at instantiation time of the object Defines an Active Object activity { … }

  7. Passive Object Active Object Concepts • More about activities • No activity, one or more activities per class • Derived classes can define their own activities • All activities are started at instantiation time (incl. Base class activities) and run in parallel class ActiveObj { …. activity { … } activity { … } } class DerivedActiveObj : ActiveObj { … activity { … } … }

  8. Concepts • Channels • Vehicle for the implementation of formal dialogues • Channel type formal dialogue Interface • Channel instance dialogue in execution • Channel implementation syntax parser Parser code channel MyChannel { … }

  9. Set of implemented protocols Concepts • More about channels • Remote Interface of an object • Channel instances run in separate threads • Opened and closed by a client • Member of a class • In contrast to activities: • controlled by client • one instance (thread) per connection • communication capabilities (through accessors)

  10. back direction Concepts • Communication follows a formal dialogue • Exchange of syntactic tokens • Can be described by an EBNF syntax • bi-directional definition • Parser defines semantic actions • Strongly typed tokens • Dialogue has its own status Example: ParkingLot = GetFree freeList parkingLot success freeList = { parkingLot } Partners do not store the status

  11. Concepts Intrinsic activity of object Client A Channel protocoldefined as2 player syntax Channel instance Server Client B

  12. d Channel type D? open D exchange syntactic tokens Concepts • Example: A B [ACK]

  13. Save precondition for programming language independency Concepts • Advantages to Remote Method Invocation: • Sender is not blocked • State of the dialogue is completely captured by the channel • Tokens are typed by the underlying grammar and encoded according to universal rules.

  14. Model Components & data flow abstraction

  15. Implemented as public static methods inline (private) Model • Channel accessors: • open Instantiate channel, invoke parser • close abort parser thread • send pass token to buffer of remote channel • receive read token from buffer of remote channel • put pass token to internal channel buffer • get read token from internal channel buffer

  16. Concrete example-implementation: TCP/IP Separation: Independent implementation Model 3 layer model for remote channels Implemented by the parser of a channel and the client which opens the channel Handling of channel instances. Abstraction of the communication technology Implementation of the transport technology. Responsible to transmit data blocks between destination. Exchangeable for any transport technology.

  17. Model { c = new b.C }

  18. Model • Gateway channels • Abstraction of a remotely available channel in the clients address space • ONE gateway (instead of proxies) • Implemented as member of channel manager • ChannelManager.RemoteChannel • Buffer content is directlysent to the remotechannel managerand vice versa

  19. Model • Transmit Buffer-Content by channel manager • Channel Provider: Tracking buffers of channel instances • Client: Tracking buffers of RemoteChannel instances • Channel instances are identified by GUID

  20. Model • Home Channel: • Query for implemented protocols • Implicitly implemented (by the compiler) for any channel provider • Provides a query mechanism comparable to COM (IUnknown) • Behaves exactly like any other channelbut follows a fixed syntax • Syntax • List names of implemented channels “list” nOfChannels { “channel”ChannelTypeName }

  21. Implementation (Compiler) Channel variable (reference)

  22. Implementation (Compiler) • Threading model • Thread represents channel instance • Buffer references stored relative to thread context • Thread is started by open accessor • Code example Advantage: Possibility to call channel accessors outside the parser method Named thread slots IL_001d: ldstr "$outBuf$“ IL_0022: call class [mscorlib]System.LocalDataStoreSlot [mscorlib]System.Threading.Thread::GetNamedDataSlot(string) IL_0027: ldloca.s V_0 IL_0029: ldfld class System.Channels.Buffer System.Channels.ChannelManager/RemoteChannel::$outBuf$ IL_002e: call void [mscorlib]System.Threading.Thread::SetData(class [mscorlib]System.LocalDataStoreSlot, object)

  23. Implementation (Library) • Token • Map a set of basic types:char, int, long, float, double, keyword, string, bool, block, escape • Define their own encoding • Basic Format: tagByte { dataByte } • Shortest encoding for most frequently used types • Use value bits in the tag byte (for small data types) • Buffer • Ring-buffer implementation • enlarged automatically if the get full • Limit can be specified enumerations

  24. Implementation (Library) • Channel manager • Responsible to handle channel instances and map their corresponding parts (local/remote) • Defines gateway channel • Channel manager messages: • Open/Close requests • Data transmission • Close enquiry • Acknowledgements GUID close idle channels

  25. Implementation (Library) • Transport manager • Abstract class • Must be implemented for a specific technology • Current implementations: TCP/IP, Nullmodem • Must provide reliable transmission of encoded data • Destination Abstraction of the communication end-point

  26. Implementation (Compiler/Library) • Implicit interface for channel providers • Defined in library, implemented by compiler • ChannelManager calls OpenChannel method of specific channel implementation • OpenChannel method • Implicitly generated by the compiler • Maps channel names to channel types • Returns buffer and thread references by ChannelNode structure public interface IChannel { ChannelNode OpenChannel(string name); }

  27. class ParkingService {bool[] freeList;channel ParkingLot { Token currentToken; …while(true) { ?currentToken;if(currentToken is TokenKeyword && (Keywords) currentToken.Value == Keywords.GetFree) { SendFreeList(); ?currentToken; success = Park((int) (currentToken.Value)); !Token.NewToken(success); } } … } } Server Client Implementation (Example) ParkingLot = GetFree freeList parkingLot success int number, chosed; bool parked;// get free parking lotsmyChannel!Token.NewToken(Keywords.GetFree);myChannel?receivedToken;while((int) receivedToken.Value != -1) { Console.Write("{0} ", (int) receivedToken.Value); myChannel?receivedToken; }// chose one of the free parking lotsmyChannel!Token.NewToken(chosed);myChannel?receivedToken;parked = (bool) receivedToken.Value; enum

  28. Development platform for tiny devices (outlook) • Cross compiler: IL StrongARM • Limited to the functionality demanded by tiny devices • Device represents active object • Implement a specific transport technology • Bluetooth / Smart-Its (University of Karlsruhe) • ‘Burn’ mechanism invokes cross compiler and builds operating system environment of the small device

  29. Reference • .NET Developer’s Journal, Volume 01, Issue 3 • A New Approach to Remote Object Communication • http://www.sys-con.com/dotnet/

More Related