JavaSpaces and TSpaces
-
Upload
guinevere-mckinney -
Category
Documents
-
view
42 -
download
0
description
Transcript of JavaSpaces and TSpaces
![Page 1: JavaSpaces and TSpaces](https://reader036.fdocuments.us/reader036/viewer/2022081421/56813280550346895d991b56/html5/thumbnails/1.jpg)
JavaSpaces and TSpaces
Theresa Tamash
CDA 5937
November 4, 2002
![Page 2: JavaSpaces and TSpaces](https://reader036.fdocuments.us/reader036/viewer/2022081421/56813280550346895d991b56/html5/thumbnails/2.jpg)
Outline
Challenges of Distributed Computing Solutions for Distributed Systems Linda Tuplespaces JavaSpaces TSpaces
![Page 3: JavaSpaces and TSpaces](https://reader036.fdocuments.us/reader036/viewer/2022081421/56813280550346895d991b56/html5/thumbnails/3.jpg)
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.
![Page 4: JavaSpaces and TSpaces](https://reader036.fdocuments.us/reader036/viewer/2022081421/56813280550346895d991b56/html5/thumbnails/4.jpg)
Example (communication challenge)
AIX
LINUX
WindowsPrinter
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.
![Page 5: JavaSpaces and TSpaces](https://reader036.fdocuments.us/reader036/viewer/2022081421/56813280550346895d991b56/html5/thumbnails/5.jpg)
Example (auction service)
Seller
BidderBidder
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)
![Page 6: JavaSpaces and TSpaces](https://reader036.fdocuments.us/reader036/viewer/2022081421/56813280550346895d991b56/html5/thumbnails/6.jpg)
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.
![Page 7: JavaSpaces and TSpaces](https://reader036.fdocuments.us/reader036/viewer/2022081421/56813280550346895d991b56/html5/thumbnails/7.jpg)
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.
![Page 8: JavaSpaces and TSpaces](https://reader036.fdocuments.us/reader036/viewer/2022081421/56813280550346895d991b56/html5/thumbnails/8.jpg)
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
![Page 9: JavaSpaces and TSpaces](https://reader036.fdocuments.us/reader036/viewer/2022081421/56813280550346895d991b56/html5/thumbnails/9.jpg)
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 Process
Put tuple Take tuple
![Page 10: JavaSpaces and TSpaces](https://reader036.fdocuments.us/reader036/viewer/2022081421/56813280550346895d991b56/html5/thumbnails/10.jpg)
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.
![Page 11: JavaSpaces and TSpaces](https://reader036.fdocuments.us/reader036/viewer/2022081421/56813280550346895d991b56/html5/thumbnails/11.jpg)
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
![Page 12: JavaSpaces and TSpaces](https://reader036.fdocuments.us/reader036/viewer/2022081421/56813280550346895d991b56/html5/thumbnails/12.jpg)
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.
![Page 13: JavaSpaces and TSpaces](https://reader036.fdocuments.us/reader036/viewer/2022081421/56813280550346895d991b56/html5/thumbnails/13.jpg)
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
JavaSpace
Entry
![Page 14: JavaSpaces and TSpaces](https://reader036.fdocuments.us/reader036/viewer/2022081421/56813280550346895d991b56/html5/thumbnails/14.jpg)
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.
![Page 15: JavaSpaces and TSpaces](https://reader036.fdocuments.us/reader036/viewer/2022081421/56813280550346895d991b56/html5/thumbnails/15.jpg)
JavaSpace “Hello World” cont.
Message template = new Message(); //Content is nullMessage result = (Message)space.read(
template, null, Long.MAX_VALUE);System.out.println(result.content);
“Hello World”
JavaSpace
Read entry
EntryIf we had used space.take instead, the Entry object would no longer be in the space.
![Page 16: JavaSpaces and TSpaces](https://reader036.fdocuments.us/reader036/viewer/2022081421/56813280550346895d991b56/html5/thumbnails/16.jpg)
JavaSpaces Solution
Printer space
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 WindowsJVM
![Page 17: JavaSpaces and TSpaces](https://reader036.fdocuments.us/reader036/viewer/2022081421/56813280550346895d991b56/html5/thumbnails/17.jpg)
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.
![Page 18: JavaSpaces and TSpaces](https://reader036.fdocuments.us/reader036/viewer/2022081421/56813280550346895d991b56/html5/thumbnails/18.jpg)
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
![Page 19: JavaSpaces and TSpaces](https://reader036.fdocuments.us/reader036/viewer/2022081421/56813280550346895d991b56/html5/thumbnails/19.jpg)
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.
![Page 20: JavaSpaces and TSpaces](https://reader036.fdocuments.us/reader036/viewer/2022081421/56813280550346895d991b56/html5/thumbnails/20.jpg)
TSpace Tuple
<2.24, “Hello World”, 345>
This is a tuple with 3 fields:
1. Float with value 2.24
2. String with value “Hello World”
3. Integer with value 345
![Page 21: JavaSpaces and TSpaces](https://reader036.fdocuments.us/reader036/viewer/2022081421/56813280550346895d991b56/html5/thumbnails/21.jpg)
TSpace Tuple Matching
<2.24, “Hello World”, 345>
Template 1: <float, “Hello World”, int> Template 2: <float, string, 345.0>
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.
![Page 22: JavaSpaces and TSpaces](https://reader036.fdocuments.us/reader036/viewer/2022081421/56813280550346895d991b56/html5/thumbnails/22.jpg)
TSpaces Solution
Seller
BidderBidder
Bidder
TSpaceItem
Item
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.
![Page 23: JavaSpaces and TSpaces](https://reader036.fdocuments.us/reader036/viewer/2022081421/56813280550346895d991b56/html5/thumbnails/23.jpg)
JavaSpaces vs. TSpaces
Serializable objects
Multiple spaces
Simple operators
Simple types and objects
Single space
Simple operators and database functionality
![Page 24: JavaSpaces and TSpaces](https://reader036.fdocuments.us/reader036/viewer/2022081421/56813280550346895d991b56/html5/thumbnails/24.jpg)
References
Freeman, E., Hupfer, S., Arnold, K. (1999). JavaSpaces Principles, Patterns, and Practice: Chapter 1. http://developer.java.sun.com/developer/Books/JavaSpaces/introduction.html
Hupfer, Susanne (2000). The Nuts and Bolts of Compiling and Running JavaSpaces Programs.http://developer.java.sun.com/developer/technicalArticles/jini/javaspaces
Continued
![Page 25: JavaSpaces and TSpaces](https://reader036.fdocuments.us/reader036/viewer/2022081421/56813280550346895d991b56/html5/thumbnails/25.jpg)
References
(2000) JavaSpaces Service Specification v1.1.
http://wwws.sun.com/software/jini/specs/js1_1.pdf TSpaces Intelligent Connectionware.
http://www.almaden.ibm.com/cs/TSpaces/whatdo.html Wyckoff (1998). T Spaces
http://www.research.ibm.com/journal/sj/373/wyckoff.html