User Tools

Site Tools


at:tutorial:distribution

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
at:tutorial:distribution [2007/05/04 09:06] – * elisagat:tutorial:distribution [2007/07/26 11:03] – Updated stijnm
Line 5: Line 5:
 ====== Distributed Programming ====== ====== Distributed Programming ======
  
-This tutorial chapter discusses how AmbientTalk virtual machines can discover and communicate with each other over the network.  +Building on the actor-based concurrency model explained in the [[actors|previous chapter]], this chapter discusses the distribution provisions of AmbientTalk. For actors to communicate across the boundaries of a single device, actor's need to be capable of discovering one another's presence and need to be resilient to intermittent disconnections of their communication partners.
-The integration of distribution was one of the main concerns in the design of AmbientTalk programming model+
  
-More specifically, as a distributed programming language that adheres to the Ambient-Oriented Programming paradigm, AmbientTalk incorporates partial failures and discovery lookup facilities at the heart of its distributed programming model. Rather than creating stubs and skeletons to manage remote communications, AmbientTalk integrates them transparently to the developer thanks to its concurrency model based on actors and far references. Far references are in fact a vital feature of the distributed model of AmbientTalk that allows the language to be able to handle the so-called volatile connections featured in mobile ad hoc networks.  This chapter mainly explains the language abstractions to export and discover other remote objects, and handle partial failures. But firstlet us start simply by showing how to enable the network functionality.+These requirements correspond to the cornerstones of the  Ambient-Oriented Programming paradigm. The seamless integration of language support for dealing with partial failures and performing service discovery, hinge on AmbientTalk'concurrency model based on actors and far references. This chapter will explore the discovery mechanisms to create far references which span different devices, and illustrate how such far references are able to deal with intermittent disconnections in mobile ad hoc networks.  
 + 
 +Before delving in these topicswe illustrate how to activate the network facilities of AmbientTalk in the next section.
  
 ===== Starting the Network.. ===== ===== Starting the Network.. =====
Line 14: Line 15:
 AmbientTalk provides an unique native object, named ''network'',  that responds to two methods that control the network access to an AmbientTalk virtual machine. More specifically, ''network.online()'' and ''network.offline()'' make a virtual machine go online and offline, respectively.  AmbientTalk provides an unique native object, named ''network'',  that responds to two methods that control the network access to an AmbientTalk virtual machine. More specifically, ''network.online()'' and ''network.offline()'' make a virtual machine go online and offline, respectively. 
  
-When the virtual machine goes online, this allows the built-in discovery lookup mechanism to export the local objects and let local objects to find other remote objects. AmbientTalk's discovery support will be further explained in the following section. Taking offline a virtual machine breaks immediately the connections with other virtual machines and thus, all remote reference between them are disconnected. This is a deliberate design choice made to facilitate the simulation of transient disconnections.+When the virtual machine goes online, the built-in service discovery mechanism is able to broadcast the presence of locally discoverable objects to all virtual machines in the environment, as well as acquaint local objects with discoverable objects on other devicesThe precise details of AmbientTalk's discovery support will be further explained in the following section. 
 + 
 +Taking a virtual machine offline on the other hand will immediately sever all connections with other virtual machines and thus, induce a partial failure for all references that transgress the boundaries of a single virtual machine. This is a deliberate design choice made to facilitate the simulation of transient disconnections. Note that such disconnections do not render far references unusable, as we shall explain [[distribution#partial_failure_handling|below]].
    
 <note> <note>
Line 24: Line 27:
 AmbientTalk provides language support to make some objects available to other objects residing in remote actors by means of the ''export:as:'' construct.  The ''export:as:'' construct takes as argument an object that is made remotely accessible and a service type under which the object can be discovered. For example, one exports a printing service as follows: AmbientTalk provides language support to make some objects available to other objects residing in remote actors by means of the ''export:as:'' construct.  The ''export:as:'' construct takes as argument an object that is made remotely accessible and a service type under which the object can be discovered. For example, one exports a printing service as follows:
 <code> <code>
-defstripe Printer;+deftype Printer;
 def service := object: {  def service := object: { 
  def print(aDoc) {  def print(aDoc) {
Line 33: Line 36:
 </code> </code>
  
-When an object its exported by its actor, it becomes discoverable by other actors by means of the service type. Internally, this means that the object is placed in the export table of its actor. As shown in the example, a service type is represented by a [[actors#stripes|stripes]]. This means that services types are not associated with a set of methods, but they denote an abstract publication topic that objects exports. As a stripe, a service type can thus be a subtype of one or more other service types. For example, an object could offer a color printing services by exporting the following stripe:+When an object its exported by its actor, it becomes discoverable by other actors by means of the service type. Internally, this means that the object is placed in the export table of its actor. As shown in the example, a service type is represented by a type tag. This means that services types are not associated with a set of methods, but they denote an abstract publication topic that objects exports. As a type tag, a service type can thus be a subtype of one or more other service types. For example, an object could offer a color printing services by exporting the following type tag:
 <code> <code>
-defstripe ColorPrinter <: Printer;+deftype ColorPrinter <: Printer;
 </code> </code>
  
Line 57: Line 60:
  
 <note> <note>
-We are using a future to get the return value of the ''getName'' asynchrnonus message invocation. For further details about futures and the ''when:becomes:'' language construct, we refer the reader to the previous chapter on the [[actors|concurrency model of AmbientTalk]].+We are using a future to get the return value of the ''getName'' asynchronous message invocation. For further details about futures and the ''when:becomes:'' language construct, we refer the reader to the previous chapter on the [[actors|concurrency model of AmbientTalk]].
 </note> </note>
  
Line 69: Line 72:
 Let us consider again the example instant messenger application described in previous section to further explain the semantics of AmbientTalk's remote object references and how they deal with transient disconnections.  Let us consider again the example instant messenger application described in previous section to further explain the semantics of AmbientTalk's remote object references and how they deal with transient disconnections. 
  
-When an object discovers a service type, the ''when'' observers are triggered receiving as parameter a remote far reference to the remote object discovered. As explained in previous sections, far references operates asynchronously. When a client object sends a message via a remote reference, the message is buffered in the remote far reference and the client does not even wait for the message to be delivered. This is crucial in distributed computing in order to prevent race conditions. The parameter passing semantics for messages sent to remote objects works similar to the inter-actor message sending semantics:+When an object discovers a service type, the ''when:becomes:'' observers are triggered receiving as parameter a remote far reference to the remote object discovered. As explained in previous sections, far references operates asynchronously. When a client object sends a message via a remote reference, the message is buffered in the remote far reference and the client does not even wait for the message to be delivered. This is crucial in distributed computing in order to prevent race conditions. The parameter passing semantics for messages sent to remote objects works similar to the inter-actor message sending semantics:
  
-  - Objects are always passed by far reference, except for isolate objects which are passed by copy.+  - Objects are always passed //by far reference//, except for isolate objects which are passed by copy.
   - Native data types are always passed by copy.   - Native data types are always passed by copy.
- 
  
 When a remote far reference receives a messages, it flushes the message to the remote object providing that it is connected. If the remote far reference is disconnected, messages are accumulate in its inbox in order to be transmitted once the reference becomes reconnected at a later point in time once the network connection is restored.  When a remote far reference receives a messages, it flushes the message to the remote object providing that it is connected. If the remote far reference is disconnected, messages are accumulate in its inbox in order to be transmitted once the reference becomes reconnected at a later point in time once the network connection is restored. 
at/tutorial/distribution.txt · Last modified: 2009/01/30 16:13 by tvcutsem