Presentation is loading. Please wait.

Presentation is loading. Please wait.

JavaSpaces and TSpaces Theresa Tamash CDA 5937 November 4, 2002.

Similar presentations

Presentation on theme: "JavaSpaces and TSpaces Theresa Tamash CDA 5937 November 4, 2002."— Presentation transcript:

1 JavaSpaces and TSpaces Theresa Tamash CDA 5937 November 4, 2002

2 Outline Challenges of Distributed Computing Solutions for Distributed Systems Linda Tuplespaces JavaSpaces TSpaces

3 Challenges of Distributed Computing Latency – data takes time to get across a network. Synchronization – asynchronous processes must have a certain degree of synchronization in order to work together. Partial failures – a distributed system must be able to recognize a failure and be able to adapt. Communication – processes running different operating systems may need to communicate. Persistent data – a distributed system may need somewhere to store data, besides on one of the connected computers.

4 Example (communication challenge) AIX LINUX Windows Printer Network How can the Windows or LINUX machines print documents? There is a physical connection between all computers and the printer, but no logical connection.

5 Example (auction service) Seller Bidder Server Bids may take different amounts of time to reach the server. Which bid came in first? (latency) Item must be stored on the server. (persistent data) What if the Seller or winning bidder are not connected to the network when bidding ends? (synchronization / partial failures)

6 Solution - Middleware Process A Process C Process B Middleware The middleware facilitates communication between the different processes. The middleware should be responsible for providing solutions to the problems listed earlier.

7 Middleware Solutions JavaSpaces and TSpaces Designed to overcome the challenges of distributed systems. Based on the Linda tuplespace system. Implemented in Java to be platform independent.

8 Linda Developed to be a communication buffer for parallel processing systems. Anonymous communication Associative addressing / pattern matching Persistent data Simple syntax Portable (supports heterogeneous networks) Uses tuplespaces

9 Tuplespace Stores groups of tuples. Globally accessible memory space (probably on a network). Space Tuple – A group of fields with associated values. Basically an object. {temperature=75; windspeed=10; windunits=knots} Process Put tuple Take tuple

10 JavaSpaces A shared, network accessible repository for objects (tuplespace). Based on the tuplespace model of Linda. Objects are exchanged only through interaction with the space. Provides simple operations: read, write, take, notify.

11 JavaSpaces Key Features Shared – spaces provide concurrent access for many processes. Persistent data – spaces store objects until they expire or are removed. Associative lookup – spaces lookup objects based on their content rather than a name or memory address. Continued 

12 JavaSpaces Key Features cont. Transactionally Secure – spaces ensure that operations are atomic (either applied or not). Executable Content Sharing – spaces store objects, which have methods that can be executed once an object is read or taken from a space. Anonymous communication – spaces don’t care who the sender or receiver is.

13 JavaSpace “Hello World” public class Message implements Entry { public String content; public Message() { } Message msg = new Message(); Msg.content = “Hello World”; JavaSpace space = SpaceAccessor.getSpace(); Space.write(msg, null, Lease.FOREVER); Write entry JavaSpac e Entry

14 JavaSpace “Hello World” cont. Use pattern matching to get desired objects from the space. null values represent wildcards. A Message object with the content field set to null will return any message object. A Message object with the content field set to “Go Team!” will only return a message object with the content set to that value.

15 JavaSpace “Hello World” cont. Message template = new Message(); //Content is null Message result = (Message) template, null, Long.MAX_VALUE); System.out.println(result.content); “Hello World” JavaSpac e Read entry Entry If we had used space.take instead, the Entry object would no longer be in the space.

16 JavaSpaces Solution Printer spac e 1. Windows machine writes a printerDocument object to the space. 2. AIX machine is notified when any printerDocument object is written to the space. He takes them upon notification. 3. AIX machine sends the document to the printer to print. The Java Virtual Machines (JVM) enable communication between the two different operating systems through the JavaSpace. AIX JVM Windows JVM

17 TSpaces Similar to JavaSpaces Based on Linda Implemented in Java for platform independence. Tuples are exchanged through the space. Provides simple operations; read, write, take: as well as more complex operations and database functionality.

18 TSpaces Key Features Standard set of tuplespace operators – read and in (both in blocking and non-blocking), out, scan. Dynamically defined datatypes and operators – New datatypes and operators can be defined and downloaded to the TSpaces server and used immediately. Persistent data – relational database features. Continued 

19 TSpaces Key Features cont. Database indexing and querying – Provides capability for efficient and powerful data retrieval. Access Control – Configurable security settings. Event Notification – Processes can register to be notified of events.

20 TSpace Tuple This is a tuple with 3 fields: 1.Float with value 2.24 2.String with value “Hello World” 3.Integer with value 345

21 TSpace Tuple Matching Template 1: Template 2: Both templates use formal fields. By putting the datatype in the template and not specifying a value, the template will match tuples with that datatype in that field.

22 TSpaces Solution Seller Bidder TSpace Item Seller writes Item tuple to space. Bidders can register to receive notification when certain types of Items (pink?) are written to the space. Bidders can take an Item from a space, update the bid, then write it back. Bidders can query the group of Item tuples to find ones that interest them. Seller registers to be notified when bidding ends on their Item.

23 JavaSpaces vs. TSpaces Serializable objects Multiple spaces Simple operators Simple types and objects Single space Simple operators and database functionality

24 References Freeman, E., Hupfer, S., Arnold, K. (1999). JavaSpaces Principles, Patterns, and Practice: Chapter 1. aces/introduction.html aces/introduction.html Hupfer, Susanne (2000). The Nuts and Bolts of Compiling and Running JavaSpaces Programs. es/jini/javaspaces Continued 

25 References (2000) JavaSpaces Service Specification v1.1. TSpaces Intelligent Connectionware. Wyckoff (1998). T Spaces ml ml

Download ppt "JavaSpaces and TSpaces Theresa Tamash CDA 5937 November 4, 2002."

Similar presentations

Ads by Google