Tuple space

Last updated

A tuple space is an implementation of the associative memory paradigm for parallel/distributed computing. It provides a repository of tuples that can be accessed concurrently. As an illustrative example, consider that there are a group of processors that produce pieces of data and a group of processors that use the data. Producers post their data as tuples in the space, and the consumers then retrieve data from the space that match a certain pattern. This is also known as the blackboard metaphor. Tuple space may be thought as a form of distributed shared memory.

Contents

Tuple spaces were the theoretical underpinning of the Linda language developed by David Gelernter and Nicholas Carriero at Yale University in 1986.

Implementations of tuple spaces have also been developed for Java (JavaSpaces), Lisp, Lua, Prolog, Python, Ruby, Smalltalk, Tcl, and the .NET Framework.

Object Spaces

Object Spaces is a paradigm for development of distributed computing applications. It is characterized by the existence of logical entities, called Object Spaces. All the participants of the distributed application share an Object Space. A provider of a service encapsulates the service as an Object , and puts it in the Object Space. Clients of a service then access the Object Space, find out which object provides the needed service, and have the request serviced by the object.

Object Spaces, as a computing paradigm, was put forward in the 1980s by David Gelernter at Yale University. Gelernter developed a language called Linda to support the concept of global object coordination.

Object Space can be thought of as a virtual repository, shared amongst providers and accessors of network services, which are themselves abstracted as objects. Processes communicate among each other using these shared objects by updating the state of the objects as and when needed.

An object, when deposited into a space, needs to be registered with an Object Directory in the Object Space. Any processes can then identify the object from the Object Directory, using properties lookup, where the property specifying the criteria for the lookup of the object is its name or some other property which uniquely identifies it. A process may choose to wait for an object to be placed in the Object Space, if the needed object is not already present.

Objects, when deposited in an Object Space are passive, i.e., their methods cannot be invoked while the objects are in the Object Space. Instead, the accessing process must retrieve it from the Object Space into its local memory, use the service provided by the object, update the state of the object and place it back into the Object Space.

This paradigm inherently provides mutual exclusion. Because once an object is accessed, it has to be removed from the Object Space, and is placed back only after it has been released. This means that no other process can access an object while it is being used by one process, thereby ensuring mutual exclusion.

JavaSpaces

JavaSpaces is a service specification providing a distributed object exchange and coordination mechanism (which may or may not be persistent) for Java objects. It is used to store the distributed system state and implement distributed algorithms. In a JavaSpace, all communication partners (peers) communicate and coordinate by sharing state.

JavaSpaces can be used to achieve scalability through parallel processing, it can also be used to provide reliable storage of objects through distributed replication, although this won't survive a total power failure like a disk; it is regarded by many to be reliable as long as the power is reliable. Distribution can also be to remote locations; however, this is rare as JavaSpaces are usually used for low-latency, high-performance applications rather than reliable object caching.

The most common software pattern used in JavaSpaces is the Master-Worker pattern. The Master hands out units of work to the "space", and these are read, processed and written back to the space by the workers. In a typical environment there are several "spaces", several masters and many workers; the workers are usually designed to be generic, i.e. they can take any unit of work from the space and process the task.

JavaSpaces is part of the Java Jini technology, which on its own has not been a commercial success. [1] The technology has found and kept new users over the years and some vendors are offering JavaSpaces-based products. JavaSpaces remains a niche technology mostly used in the financial services and telco industries where it continues to maintain a faithful following. The announcement of Jini/JavaSpaces created quite some hype although Sun co-founder and chief Jini architect Bill Joy put it straight that this distributed systems dream will take "a quantum leap in thinking". [2]

Example usage

The following example shows an application made using JavaSpaces. First, an object to be shared in the Object Space is made. Such an object is called an Entry in JavaSpace terminology. Here, the Entry is used to encapsulate a service which returns a Hello World! string, and keeps track of how many times it was used. The server which provides this service will create an Object Space, or JavaSpace. The Entry is then written into the JavaSpace. The client reads the entry from the JavaSpace and invokes its method to access the service, updating its usage count by doing so. The updated Entry is written back to the JavaSpace.

// An Entry classpublicclassSpaceEntryimplementsEntry{publicfinalStringmessage="Hello World!";publicIntegercount=0;publicStringservice(){++count;returnmessage;}publicStringtoString(){return"Count: "+count;}}
// Hello World! serverpublicclassServer{publicstaticvoidmain(String[]args)throwsException{SpaceEntryentry=newSpaceEntry();// Create the Entry objectJavaSpacespace=(JavaSpace)space();// Create an Object Space// Register and write the Entry into the Spacespace.write(entry,null,Lease.FOREVER);// Pause for 10 seconds and then retrieve the Entry and check its state.Thread.sleep(10*1000);SpaceEntrye=space.read(entry,null,Long.MAX_VALUE);System.out.println(e);}}
// ClientpublicclassClient{publicstaticvoidmain(String[]args)throwsException{JavaSpacespace=(JavaSpace)space();SpaceEntrye=space.take(newSpaceEntry(),null,Long.MAX_VALUE);System.out.println(e.service());space.write(e,null,Lease.FOREVER);}}

Books

Interviews

Articles

See also

Related Research Articles

In distributed computing, a remote procedure call (RPC) is when a computer program causes a procedure (subroutine) to execute in a different address space, which is written as if it were a normal (local) procedure call, without the programmer explicitly writing the details for the remote interaction. That is, the programmer writes essentially the same code whether the subroutine is local to the executing program, or remote. This is a form of client–server interaction, typically implemented via a request–response message-passing system. In the object-oriented programming paradigm, RPCs are represented by remote method invocation (RMI). The RPC model implies a level of location transparency, namely that calling procedures are largely the same whether they are local or remote, but usually, they are not identical, so local calls can be distinguished from remote calls. Remote calls are usually orders of magnitude slower and less reliable than local calls, so distinguishing them is important.

In computing, the Java Remote Method Invocation is a Java API that performs remote method invocation, the object-oriented equivalent of remote procedure calls (RPC), with support for direct transfer of serialized Java classes and distributed garbage-collection.

The Common Object Request Broker Architecture (CORBA) is a standard defined by the Object Management Group (OMG) designed to facilitate the communication of systems that are deployed on diverse platforms. CORBA enables collaboration between systems on different operating systems, programming languages, and computing hardware. CORBA uses an object-oriented model although the systems that use the CORBA do not have to be object-oriented. CORBA is an example of the distributed object paradigm.

In computer programming, lazy initialization is the tactic of delaying the creation of an object, the calculation of a value, or some other expensive process until the first time it is needed. It is a kind of lazy evaluation that refers specifically to the instantiation of objects or other resources.

Jini, also called Apache River, is a network architecture for the construction of distributed systems in the form of modular co-operating services. JavaSpaces is a part of the Jini.

This article compares two programming languages: C# with Java. While the focus of this article is mainly the languages and their features, such a comparison will necessarily also consider some features of platforms and libraries. For a more detailed comparison of the platforms, see Comparison of the Java and .NET platforms.

<span class="mw-page-title-main">Concurrency (computer science)</span> Ability to execute a task in a non-serial manner

In computer science, concurrency is the ability of different parts or units of a program, algorithm, or problem to be executed out-of-order or in partial order, without affecting the outcome. This allows for parallel execution of the concurrent units, which can significantly improve overall speed of the execution in multi-processor and multi-core systems. In more technical terms, concurrency refers to the decomposability of a program, algorithm, or problem into order-independent or partially-ordered components or units of computation.

In computer science, Linda is a coordination model that aids communication in parallel computing environments. Developed by David Gelernter, it is meant to be used alongside a full-fledged computation language like Fortran or C where Linda's role is to "create computational activities and to support communication among them".

<span class="mw-page-title-main">Dependency injection</span> Software programming technique

In software engineering, dependency injection is a programming technique in which an object or function receives other objects or functions that it requires, as opposed to creating them internally. Dependency injection aims to separate the concerns of constructing objects and using them, leading to loosely coupled programs. The pattern ensures that an object or function which wants to use a given service should not have to know how to construct those services. Instead, the receiving 'client' is provided with its dependencies by external code, which it is not aware of. Dependency injection makes implicit dependencies explicit and helps solve the following problems:

Concurrent computing is a form of computing in which several computations are executed concurrently—during overlapping time periods—instead of sequentially—with one completing before the next starts.

In the Java computer programming language, an annotation is a form of syntactic metadata that can be added to Java source code. Classes, methods, variables, parameters and Java packages may be annotated. Like Javadoc tags, Java annotations can be read from source files. Unlike Javadoc tags, Java annotations can also be embedded in and read from Java class files generated by the Java compiler. This allows annotations to be retained by the Java virtual machine at run-time and read via reflection. It is possible to create meta-annotations out of the existing ones in Java.

Generics are a facility of generic programming that were added to the Java programming language in 2004 within version J2SE 5.0. They were designed to extend Java's type system to allow "a type or method to operate on objects of various types while providing compile-time type safety". The aspect compile-time type safety was not fully achieved, since it was shown in 2016 that it is not guaranteed in all cases.

<span class="mw-page-title-main">Space-based architecture</span>

A Space-based architecture (SBA) is an approach to distributed computing systems where the various components interact with each other by exchanging tuples or entries via one or more shared spaces. This is contrasted with the more common Message queuing service approaches where the various components interact with each other by exchanging messages via a message broker. In a sense, both approaches exchange messages with some central agent, but how they exchange messages is very distinctive.

Judoscript is a general purpose programming language designed primarily for scripting tasks on the Java platform. It was conceived and developed by James Jianbo Huang, starting in late 2001. Judoscript was one of the first so-called Java scripting languages; but its most striking characteristics is its audacious multi-domain support philosophy and practice.

The Handle System is the Corporation for National Research Initiatives's proprietary registry assigning persistent identifiers, or handles, to information resources, and for resolving "those handles into the information necessary to locate, access, and otherwise make use of the resources".

Rinda is a software library for creating modular and distributed co-operating services in Ruby using the tuple space or Linda distributed computing paradigm.

OptimJ is an extension for Java with language support for writing optimization models and abstractions for bulk data processing. The extensions and the proprietary product implementing the extensions were developed by Ateji which went out of business in September 2011. OptimJ aims at providing a clear and concise algebraic notation for optimization modeling, removing compatibility barriers between optimization modeling and application programming tools, and bringing software engineering techniques such as object-orientation and modern IDE support to optimization experts.

Gson is an open-source Java library to serialize and deserialize Java objects to JSON.

Join-patterns provides a way to write concurrent, parallel and distributed computer programs by message passing. Compared to the use of threads and locks, this is a high level programming model using communication constructs model to abstract the complexity of concurrent environment and to allow scalability. Its focus is on the execution of a chord between messages atomically consumed from a group of channels.

The Java programming language's Java Collections Framework version 1.5 and later defines and implements the original regular single-threaded Maps, and also new thread-safe Maps implementing the java.util.concurrent.ConcurrentMap interface among other concurrent interfaces. In Java 1.6, the java.util.NavigableMap interface was added, extending java.util.SortedMap, and the java.util.concurrent.ConcurrentNavigableMap interface was added as a subinterface combination.

References

  1. Lee Gomes: "Sun Microsystems' Predictions For Jxta System Sound Familiar". The Wall Street Journal, June 4th 2001
  2. Rob Guth: "More than just another pretty name: Sun's Jini opens up a new world of distributed computer systems". SunWorld, August 1998 [15 January 2006]

Sources