Upload
sheng-tian
View
813
Download
0
Embed Size (px)
Citation preview
GENERATIVE COMMUNICATION IN LINDA AND OBJECT/TUPLE SPACE - Sheng Tian, [email protected]
LINDA: COORDINATION AMONG PARALLEL PROCESSES THROUGH TUPLE SPACE.
2
COMMUNICATE VIA TUPLE SPACE
To send to B, A generates a tuple out(N, P2, …, Pj)
… and B withdraws it in(N, P2, …, Pj) 3
BASIC OPERATIONS ON THE TUPLES AND TUPLE SPACES Tuple: N, P2, …, Pj
N is an actual parameter of type name P2, …, Pj is a list of parameters each of which may be either an actual or a
formal.
Insert: out(N, P2, …, Pj) Execution of the out() statement results in insertion of the tuple N, P2,
…, Pj into TS Blocking read and delete: in(N, P2, …, Pj)
If some type-consonant tuple whose first component is “N” exists in TS, the tuple withdraw from TS
If no matching tuple is available in TS, in() suspends until one is available
Blocking read: read(N, P2, …, Pj) Same as in() statement but the tuple remains in TS. Both in() and read() are logically nondeterminism
Tuple names are global to a given program’s TS. Update tuple: delete and reinsert Predicate operations: inp and rdp 4
TUPLE SPACES BASICS OPERATIONS
5
AGENDA
Background Basic Concepts in Generative Communication Distinguishing Properties of Linda Case Study Discussion
6
BACKGROUND
Three basic models of concurrent programming: Monitors (shared variables) Message passing Remote Operations
Cons Partially distributed in space Nondistributed in time
New Model: Generative communication Fully distributed in space and time
7
BASIC CONCEPTS Tuple
A tuple is a fixed-length list containing elements that do not need to have the same type.
Tuple/Object Space A virtual repository of tuple, shared amongst providers and accessors
of network services, that can be accessed concurrently All the participants of the distributed application share an Object
Space. Processes communicate among each other using these shared objects –
by updating the state of the objects as and when needed
Linda A model of coordination and communication among several parallel
processes operating upon objects stored in and retrieved from Tuple Space.
Generative Communication Model Why it is said to be generative? Because, until it is explicitly
withdrawn, the tuple generated by A has an independent existence in TS.
8
DISTINGUISHING PROPERTIES (1/2)
Communication orthogonality p1: Space-uncoupling
A tuple in TS tagged “P” may be input by any number of address-space-disjoint processes
p2: Time-uncoupling Tuples added to TS by out() remains in TS until it is
removed by in()
p3: Distributed sharing Linda allows j address-space-disjoint processes to share
some variable v by depositing it in TS.
9
SPACE AND TIME UNCOUPLING
Space-disjoint processes A and B communicate via TS
Time-disjoint processes C and D. C terminates before D starts – Likewise communicate via TS 10
DISTINGUISHING PROPERTIES (2/2)
Free naming p4: Support for continuation passing
Linda allows name-type values to be tuple components and to be stored in arbitrary data structures in the same way as values of any other type.
p5: Structured naming Structured naming make TS content-addressable e.g.
The statement in(P, i: integer, j:boolean)
Requests a tuple with name “P”, but it is also possible to write in(P, i:integer, FALSE) and in(P, 2, FALSE)
It allows in() and read() statements to restrict, and out() statements to widen, their focus.
11
CASE STUDY (1/2)
Database Search Problem We are given a file containing a set of search data, a target,
and a routine that computes a numeric score for single datum/target pair.
A manager makes a series of out requests to place the search data in the tuple space, then performs in operations to retrieve the results generated by workers
12
CASE STUDY (2/2)
13
begin count = 0 until EOF do read datum from file OUT("datum", datum) count = count + 1 enddo best = 0.0 for i = 1 to count IN("score", value) if value > best then best = value
endfor for i = 1 to numworkers OUT("datum", "stop") endfor
end
begin IN("datum", datum) until datum = "stop" do
value = compare(datum, target)
OUT("score", value)
IN("datum", datum)
enddo end
procedure manager procedure worker
SPACE BASED ARCHITECTURE
Object Spaces is a paradigm for development of distributed computing applications.
Spaces can be used to achieve scalability through parallel procesing.
Objects, when deposited in an Object Space are passive, i.e., their methods cannot be invoked while the objects are in the Object Space.
This paradigm inherently provides mutual exclusion. Linda coordination language was developed at Yale. Object Spaces is usually called Tuple Spaces since it
contains of tuples unrelated to each others. 14
IMPLEMENTATIONS OF TUPLE SPACES Java
Sun’s JavaSpaces GigaSpaces OpenSpaces
IBM’s Tspaces ActiveSpace Jada LighTS Jxtaspaces for P2P GLOBE Blitz
C Scientific Computing
Associates’ TCP-Linda W.F. Wong’s Simple C-
Linda with Posix Threads
HTML Page Spaces Masatoshi Seki’s Rinda,
part of DistributedRuby dRuby
Ruple for Ruby p4-Linda Python
PyBrenda in Python PyLinda. Linda
implementation in Python Matlab: NetWorkSpaces
Note: Ruple use XML documents
instead of tuples 15
DISCUSSION (1/2)
Message queue vs. Tuple space Messages go from one person to another. Only the intended
recipient of a message gets to see it. Tuple Space is a bag with tuple in it. The tuples in TS can
be read and processed by anyone. It is possible to force sequencing of messages by including a
time, matching on all messages, then selecting the message with the earliest time.
Message passing must has a destination. No matter it's a single dest or a group. However Tuple space is distributed. Workers don't know each other.
Broadcast messages are not like Tuple Space. A broadcast message is received by everyone whether they
want it or not Tuples are extracted or copied under the control of the reader/
receiver 16
DISCUSSION (2/2)
Tuple Space Scalability Tuple Space won’t work on the Internet, because of
its underlying “distributed shared memory” idea
17