Tuple space
Encyclopedia
A tuple space is an implementation of the associative memory
Content-addressable memory
Content-addressable memory is a special type of computer memory used in certain very high speed searching applications. It is also known as associative memory, associative storage, or associative array, although the last term is more often used for a programming data structure...

 paradigm for parallel/distributed computing. It provides a repository of tuple
Tuple
In mathematics and computer science, a tuple is an ordered list of elements. In set theory, an n-tuple is a sequence of n elements, where n is a positive integer. There is also one 0-tuple, an empty sequence. An n-tuple is defined inductively using the construction of an ordered pair...

s 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
Distributed shared memory
Distributed Shared Memory , in Computer Architecture is a form of memory architecture where the memories can be addressed as one address space...

.

Tuple spaces were the theoretical underpinning of the Linda
Linda (coordination language)
In computer science, Linda is a model of coordination and communication among several parallel processes operating upon objects stored in and retrieved from shared, virtual, associative memory...

 language developed by David Gelernter
David Gelernter
David Hillel Gelernter is a professor of computer science at Yale University. In the 1980s, he made seminal contributions to the field of parallel computation, specifically the tuple space coordination model, as embodied by the Linda programming system...

 and Nicholas Carriero at Yale University
Yale University
Yale University is a private, Ivy League university located in New Haven, Connecticut, United States. Founded in 1701 in the Colony of Connecticut, the university is the third-oldest institution of higher education in the United States...

.

Implementations of tuple spaces have also been developed for Java
Java (programming language)
Java is a programming language originally developed by James Gosling at Sun Microsystems and released in 1995 as a core component of Sun Microsystems' Java platform. The language derives much of its syntax from C and C++ but has a simpler object model and fewer low-level facilities...

 (JavaSpaces), Lisp, Lua, Prolog
Prolog
Prolog is a general purpose logic programming language associated with artificial intelligence and computational linguistics.Prolog has its roots in first-order logic, a formal logic, and unlike many other programming languages, Prolog is declarative: the program logic is expressed in terms of...

, Python
Python (programming language)
Python is a general-purpose, high-level programming language whose design philosophy emphasizes code readability. Python claims to "[combine] remarkable power with very clear syntax", and its standard library is large and comprehensive...

, Ruby
Ruby (programming language)
Ruby is a dynamic, reflective, general-purpose object-oriented programming language that combines syntax inspired by Perl with Smalltalk-like features. Ruby originated in Japan during the mid-1990s and was first developed and designed by Yukihiro "Matz" Matsumoto...

, Smalltalk
Smalltalk
Smalltalk is an object-oriented, dynamically typed, reflective programming language. Smalltalk was created as the language to underpin the "new world" of computing exemplified by "human–computer symbiosis." It was designed and created in part for educational use, more so for constructionist...

, Tcl
Tcl
Tcl is a scripting language created by John Ousterhout. Originally "born out of frustration", according to the author, with programmers devising their own languages intended to be embedded into applications, Tcl gained acceptance on its own...

, and the .NET framework
.NET Framework
The .NET Framework is a software framework that runs primarily on Microsoft Windows. It includes a large library and supports several programming languages which allows language interoperability...

.

Object Spaces

Object Spaces is a paradigm
Paradigm
The word paradigm has been used in science to describe distinct concepts. It comes from Greek "παράδειγμα" , "pattern, example, sample" from the verb "παραδείκνυμι" , "exhibit, represent, expose" and that from "παρά" , "beside, beyond" + "δείκνυμι" , "to show, to point out".The original Greek...

 for development of distributed computing
Distributed computing
Distributed computing is a field of computer science that studies distributed systems. A distributed system consists of multiple autonomous computers that communicate through a computer network. The computers interact with each other in order to achieve a common goal...

 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
Object-oriented programming
Object-oriented programming is a programming paradigm using "objects" – data structures consisting of data fields and methods together with their interactions – to design applications and computer programs. Programming techniques may include features such as data abstraction,...

, 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 by David Gelernter
David Gelernter
David Hillel Gelernter is a professor of computer science at Yale University. In the 1980s, he made seminal contributions to the field of parallel computation, specifically the tuple space coordination model, as embodied by the Linda programming system...

 at Yale University
Yale University
Yale University is a private, Ivy League university located in New Haven, Connecticut, United States. Founded in 1701 in the Colony of Connecticut, the university is the third-oldest institution of higher education in the United States...

. Gelernter developed a language called Linda
Linda (coordination language)
In computer science, Linda is a model of coordination and communication among several parallel processes operating upon objects stored in and retrieved from shared, virtual, associative memory...

 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
Mutual exclusion
Mutual exclusion algorithms are used in concurrent programming to avoid the simultaneous use of a common resource, such as a global variable, by pieces of computer code called critical sections. A critical section is a piece of code in which a process or thread accesses a common resource...

. 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
Scalability
In electronics scalability is the ability of a system, network, or process, to handle growing amount of work in a graceful manner or its ability to be enlarged to accommodate that growth...

 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 to 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
Jini
Jini , also called Apache River, is a network architecture for the construction of distributed systems in the form of modular co-operating services.Originally developed by Sun, Jini was released under an open source license...

 technology, which on its own has not been a commercial success. 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
Bill Joy
William Nelson Joy , commonly known as Bill Joy, is an American computer scientist. Joy co-founded Sun Microsystems in 1982 along with Vinod Khosla, Scott McNealy and Andy Bechtolsheim, and served as chief scientist at the company until 2003...

 put it straight that this distributed systems dream will take "a quantum leap in thinking".

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 class
public class SpaceEntry implements Entry {
public final String message = "Hello World!";
public Integer count = 0;

public String service {
++count;
return message;
}

public String toString {
return "Count: " + count;
}
}

// Hello World! server
public class Server {
public static void main(String[] args) throws Exception {
SpaceEntry entry = new SpaceEntry; // Create the Entry object
JavaSpace space = (JavaSpace)space; // Create an Object Space
// Register and write the Entry into the Space
space.write(entry, null, Lease.FOREVER);
// Pause for 10 seconds and then retrieve the Entry and check its state.
Thread.sleep(10 * 1000);
SpaceEntry e = space.read(entry, null, Long.MAX_VALUE);
System.out.println(e);
}
}

// Client
public class Client {
public static void main(String[] args) throws Exception {
JavaSpace space = (JavaSpace) space;
SpaceEntry e = space.take(new SpaceEntry, null, Long.MAX_VALUE);
System.out.println(e.service);
space.write(e, null, Lease.FOREVER);
}
}

Books

  • Eric Freeman
    Eric Freeman (writer)
    Eric Freeman is a computer scientist, author and constituent of David Gelernter on the Lifestreaming concept.-Authored works:Eric Freeman has publishing accolades for Head First HTML with CSS & XHTML which he co-authored with Elisabeth Freeman, and Head First Design Patterns also co-authored with...

    , Susanne Hupfer, Ken Arnold
    Ken Arnold
    Kenneth Cutts Richard Cabot Arnold is an American computer programmer well known as one of the developers of the 1980s dungeon-crawling computer game Rogue, for his contributions to the original Berkeley distribution of Unix, for his books and articles about C and C++ Kenneth Cutts Richard Cabot ...

    : JavaSpaces Principles, Patterns, and Practice. Addison-Wesley Professional, 1. June 1999, ISBN 0-201-30955-6
  • Phil Bishop, Nigel Warren: JavaSpaces in Practice. Addison Wesley, 2002, ISBN 0-321-11231-8
  • Max K. Goff: Network Distributed Computing: Fitscapes and Fallacies, 2004, Prentice Hall, ISBN 0131001523
  • Sing Li, et al.: Professional Java Server Programming, 1999, Wrox Press, ISBN 1861002777
  • Steven Halter: JavaSpaces Example by Example, 2002, Prentice Hall PTR, ISBN 0-13-061916-7

Tuple Space Implementations

Project Supported Languages License used Notable features
Apache River  Java Apache License
Apache License
The Apache License is a copyfree free software license authored by the Apache Software Foundation . The Apache License requires preservation of the copyright notice and disclaimer....

 
Based on the Jini
Jini
Jini , also called Apache River, is a network architecture for the construction of distributed systems in the form of modular co-operating services.Originally developed by Sun, Jini was released under an open source license...

 project that Sun
Sun Microsystems
Sun Microsystems, Inc. was a company that sold :computers, computer components, :computer software, and :information technology services. Sun was founded on February 24, 1982...

 contributed to Apache
Apache Software Foundation
The Apache Software Foundation is a non-profit corporation to support Apache software projects, including the Apache HTTP Server. The ASF was formed from the Apache Group and incorporated in Delaware, U.S., in June 1999.The Apache Software Foundation is a decentralized community of developers...

. See page.
The Blitz Project Java BSD License  Single site server.
The Fly Object Space Java, Ruby, Scala Commercial.
Allows free non-commercial use.
GigaSpaces Java, .Net, C++ Commercial.
Offers free "community license" with a subset of features.
Clustered, fault-tolerant.
Linda in a Mobile Environment (LIME) Java Unknown
LinuxTuples C, Python BSD License  Clustered.
PyLinda
PyLinda
PyLinda is a Python implementation of the Linda coordination language. It is supposed to be a very simple implementation of the Linda distributed computing environment. it supports several newly proposed extensions to Linda like garbage collection, multiple tuple spaces, bulk tuple operations,...

 
Python GPL  See page
PyLinda
PyLinda is a Python implementation of the Linda coordination language. It is supposed to be a very simple implementation of the Linda distributed computing environment. it supports several newly proposed extensions to Linda like garbage collection, multiple tuple spaces, bulk tuple operations,...

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

 
Ruby Ruby License
Ruby License
The Ruby License is the open-source license applied to the Ruby programming language and also available to be used in other projects.The Free Software Foundation comments:...

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

.
SemiSpace Java Apache License
Apache License
The Apache License is a copyfree free software license authored by the Apache Software Foundation . The Apache License requires preservation of the copyright notice and disclaimer....

 
SQLSpaces Server: Java.
Clients: Java, C#, PHP, Prolog, Ruby.
AGPL (server) + LGPL (clients)
TIBCO ActiveSpaces Java, C/C++ Commercial Clustered, fault-tolerant.


Inactive Projects:
  • SlackSpaces, open-source, main website down, project source is downloadable
  • SmallSpaces, Open Source implementation of the Linda/Tuplespace programming model
  • TSpaces, by IBM for Java, project stalled since 2000

See also

  • Space-based architecture
    Space-based architecture
    Space-Based Architecture is a software architecture pattern for achieving linear scalability of stateful, high-performance applications using the tuple space paradigm. It follows many of the principles of Representational State Transfer , service-oriented architecture and Event-driven...

  • Linda (coordination language)
    Linda (coordination language)
    In computer science, Linda is a model of coordination and communication among several parallel processes operating upon objects stored in and retrieved from shared, virtual, associative memory...

  • Ken Arnold
    Ken Arnold
    Kenneth Cutts Richard Cabot Arnold is an American computer programmer well known as one of the developers of the 1980s dungeon-crawling computer game Rogue, for his contributions to the original Berkeley distribution of Unix, for his books and articles about C and C++ Kenneth Cutts Richard Cabot ...

    , lead engineer on JavaSpaces at Sun Microsystems
    Sun Microsystems
    Sun Microsystems, Inc. was a company that sold :computers, computer components, :computer software, and :information technology services. Sun was founded on February 24, 1982...

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

    , a JavaSpaces analog for Ruby
    Ruby (programming language)
    Ruby is a dynamic, reflective, general-purpose object-oriented programming language that combines syntax inspired by Perl with Smalltalk-like features. Ruby originated in Japan during the mid-1990s and was first developed and designed by Yukihiro "Matz" Matsumoto...


Sources

  • Gelernter, David
    David Gelernter
    David Hillel Gelernter is a professor of computer science at Yale University. In the 1980s, he made seminal contributions to the field of parallel computation, specifically the tuple space coordination model, as embodied by the Linda programming system...

    . "Generative communication in Linda". ACM Transactions on Programming Languages and Systems, volume 7, number 1, January 1985
  • Distributed Computing (First Indian reprint, 2004), M. L. Liu

External links

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK