The Artima Developer Community
Jiniology | Jini Books | Print | Email | First Page | Previous | Next
Sponsored Link

Make Room for JavaSpaces, Part VI
Build and Use Distributed Data Structures in Your JavaSpaces Programs
by Susan Hupfer
First Published in JavaWorld, October 2000

Page 1 of 15  >>


In this article, Susanne Hupfer introduces you to distributed data structures -- the common set of building blocks that are used in practically every space-based program. She shows you how to build and use a versatile channel distributed data structure, and illustrates its use in a distributed MP3-encoding application.

The design of any space-based application typically revolves around one or more distributed data structures. These are data structures that exist in a space where multiple processes can access and work on them at the same time -- something that is often difficult to achieve in distributed computing models.

As Figure 1 below shows, message passing and remote method invocation systems usually sequester data structures behind a centralized manager process; therefore, any process that wants to manipulate the structures will have to wait its turn and ask the manager to perform the operation on its behalf. In other words, multiple processes can't truly access a data structure simultaneously in these conventional systems.

Figure 1. Conventional systems barricade data behind a centralized
manager process (graphic courtesy of Sun Microsystems)

Distributed data structures take a very different approach that decouples the data from any one process. Distributed data structures are represented as collections of objects that, as I said earlier, can be accessed and modified by multiple processes concurrently. As Figure 2 suggests, processes can work on different pieces of the structure at the same time without getting in each other's way.

Figure 2. JavaSpaces supports concurrent access to distributed
data structures. (graphic courtesy of Sun Microsystems)

The design of any distributed data structure requires both a representation of the data structure and a protocol that processes follow to ensure that they can manipulate the structure safely and fairly. Now I'll explain how you can use entries to represent distributed data structures, and how you can use space operations to implement distributed protocols.

Page 1 of 15  >>

Jiniology | Jini Books | Print | Email | First Page | Previous | Next

Sponsored Links

Copyright © 1996-2018 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use