jSpace

 

jSpace implements tuple spaces, a blackboard memory paradigm for parallel and distributed computing, made famous by the Linda language by David Gelernter and Nicholas Carriero.

jSpace is the Java version of pSpaces, which also has implementations for Go, .NET, Swift, and JavaScript.

jSpace is far from being the first Java implementation of the blackboard model, with perhaps the best known being JavaSpaces, which rests atop Jini, Sun Microsystems' distributed services framework. Sadly, JavaSpaces never became popular (although it is apparently still used in hush-hush financial domains). Its main problem, in my humble opinion, was the complexity of setting up the JavaSpaces/Jini system, which required a level of networking skill that the tuple space concept was invented to hide.

Happily, jSpace (and its siblings) is quite straightforward to compile and install (it's just a few JAR files). The pSpace site hosts good documentation and a tutorial, which focuses mostly on the Java implementation.

To make things even easier, you can download a file containing all the necessary JAR files from here (see the bottom of the page). I've also generated the jSpaces API documentation.

My examples are based on those in the tutorial, code from the course Introduction to Coordination in Distributed Applications, and I've also lifted examples from several books, including:

Visualization

[Using VisSpace] The most significant change I've made is to write three classes to aid with the visualization of the execution of tuple space programs. VisSpace.java is a version of jSpace's SequentialSpace class which displays a window showing tuples and queries and how they match. The example on the right depicts a moment during the execution of DiningPhilosophers.java.

I've also coded PrintAreas.java, which creates a window of text areas that can be assigned as output windows to threads. These are much easier to read than a mixed-up jumble of prints to stdout. The example below shows the output from the five threads involved in the dining philosopher's problem.

[Using PrintAreas]

Neither VisSpace nor PrintAreas are "industrial strength" tools. VisSpace can only display a maximum of ten queries and ten tuples, while PrintAreas maxs out at twelve text panes, but they're quite useful for the beginner/intermediate problems included here.

Examples

Other Downloads and Links


Dr. Andrew Davison
E-mail: ad@coe.psu.ac.th
Back to the third-party libraries page