Tuple space
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.
Tuples Spaces was the theoretical underpinning of the Linda language developed by David Gelernter and Nicholas Carriero at Yale University.
Implementations of Tuple Spaces have also been developed for Smalltalk, Java (JavaSpaces), Python, Ruby, TCL and Lisp.
JavaSpaces
JavaSpaces is a service specification. It provides a distributed object exchange/co-ordination mechanism (which may or may not be persistent) for Java objects. It can be used to store the system state and implement distributed algorithms. In a JavaSpace all communication partners (peers) communicate by sharing state. It is an implementation of the Tuple spaces idea.
JavaSpaces is used to achieve scalability through parallel-processing and provides for reliable storage of objects while reducing the complexity of traditional distributed systems.
Processes perform simple operations to write new objects into a JavaSpace, take objects from a JavaSpace, or read (make a copy of) objects from the JavaSpace.
JavaSpaces technology is part of the Java Jini technology, which has not been a commercial success, although it has found and kept new users over the years. However some vendors are as of 2004 offering JavaSpaces-based products. 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" [1].
Implementations
- The Blitz Project (open-source single site server)
- SlackSpaces (open-source)(site is down)
- GigaSpaces (commercial)
Books
- Eric Freeman, Susanne Hupfer, Ken Arnold: 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-10: 0131001523
- Sing Li (and others): Professional Java Server Programming, 1999, Wrox Press, ISBN-10: 1861002777
Interviews
- Heiss, Janice J. (2003). "Computer Visions: A Conversation with David Gelernter". Sun Developer Network (SDN).
- Venners, Bill (2003). "Designing as if Programmers are People (Interview with Ken Arnold)". java.net.
- Haines, Steven (2006). "Interview: GigaSpaces". InformIT.
Articles
- Brogden, William (2007). "How Web services can use JavaSpaces". SearchWebServices.com. Retrieved 2007-04-18.
- Brogden, William (2007). "Grid computing and Web services (Beowulf, BOINC, Javaspaces)". SearchWebServices.com. Retrieved 2007-03-20.
- White, Tom (2005). "How To Build a ComputeFarm". java.net. Retrieved 2005-05-21.
- Ottinger, Joseph (2007). "Understanding JavaSpaces". theserverside. Retrieved 2007-01-31.
- Angerer, Bernhard (2005). "Loosely Coupled Communication and Coordination in Next-Generation Java Middleware". java.net. Retrieved 2006-06-03.
{{cite web}}
: Unknown parameter|coauthors=
ignored (|author=
suggested) (help) - Angerer, Bernhard (2003). "Space-Based Programming". onjava.com. Retrieved 2003-03-19.
- Sing, Li (2003). "High-impact Web tier clustering, Part 2: Building adaptive, scalable solutions with JavaSpaces". IBM developerworks.
- Mamoud,, Qusay H. (2005). "Getting Started With JavaSpaces Technology: Beyond Conventional Distributed Programming Paradigms". Sun Developer Network (SDN).
{{cite web}}
: CS1 maint: extra punctuation (link) - Hupfer, Susanne (1999). "Make room for Javaspaces, Part 1 (from 5)". JavaWorld.
Articles (non English)
- Löffler, Dr. Gerald (2004). "JavaSpaces und ihr Platz im Enterprise Java Universum, Das Modell zum Objektaustausch: JavaSpaces vorgestellt". Entwickler.com. Retrieved 2004-02-01.
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. Provider of a service encapsulates the service as an Object, and puts it in the Object Space. Clients of a service then accesses the Object Space, finds out which object provides the required service, and have the request serviced by the object.
Object Spaces, as a computing paradigm, put forward by Dr. David Gelernter at Yale University. A language called Linda was developed to support the concept of global object coordination.
Concept
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 a 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 be 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 required 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 its 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.
The main advantages of using Object Spaces are listed below.
- No explicit code needs to be written for a Service Provider to act as a server. The service needs to be encapsulated as an object and it needs to be put in an Object Space. The server need not even explicitly maintain the Object Space.
- The client need not worry about how to communicate with the server.
Usage
Object Spaces paradigm has been implemented by Sun Microsystem's JavaSpaces, among others. To build applications using Object Spaces, one needs to make Distributed Data Structures, which is a data structure that consists of objects stored in one or more Object Spaces. When these objects are accessed, the run-time support of the Object Space implementation automatically retrieves the object from its Object Space, and puts it back when the object is used.
The following example shows an application made using JavaSpaces, which requires Jini. 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, termed JavaSpace by JavaSpaces. 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 = new Integer(count.intValue() + 1);
return message;
}
public String toString() {
return "Count: " + count.toString();
}
}
// Hello World! server
public class Server
{
public static void main(String[] args)
{
try {
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 minutes and then retrieve the Entry and check its state.
Thread.sleep(10*60*1000);
SpaceEntry e = space.read(new SpaceEntry(), null, Long.MAX_VALUE);
System.out.println(e);
} catch (Exception e) {}
}
}
// Client
public class Client
{
public static void main(String[] args)
{
try {
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);
} catch (Exception e) {}
}
}
References
- ^ Rob Guth: More than just another pretty name: Sun's Jini opens up a new world of distributed computer systems. SunWorld, August 1998 [15. Januar 2006]
See Also
JavaSpaces
- Linda (coordination language)
- Ken Arnold lead engineer on JavaSpaces at Sun Microsystems
- Rinda - JavaSpaces analog for Ruby.
Sources
- Gelernter, David - Generative communication in Linda (published in ACM Transactions on Programming Languages and Systems, Vol 7 No 1, January 1985)
Object Spaces
- Distributed Computing (First Indian reprint, 2004), M. L. Liu
Implementations
- Sun Microsystems's JavaSpaces specification
- GigaSpaces Technologies' implementation of JavaSpaces
- Rinda implementation for Ruby
- LinuxTuples