IN LINDA AND OBJECT/TUPLE
- Sheng Tian, firstname.lastname@example.org
LINDA: COORDINATION AMONG
PARALLEL PROCESSES THROUGH TUPLE
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
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
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
Basic Concepts in Generative Communication
Distinguishing Properties of Linda
Three basic models of concurrent programming:
Monitors (shared variables)
Partially distributed in space
Nondistributed in time
New Model: Generative communication
Fully distributed in space and time
A tuple is a fixed-length list containing elements that do not need to
have the same type.
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
Processes communicate among each other using these shared objects –
by updating the state of the objects as and when needed
A model of coordination and communication among several parallel
processes operating upon objects stored in and retrieved from Tuple
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
DISTINGUISHING PROPERTIES (1/2)
A tuple in TS tagged “P” may be input by any number of
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.
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)
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
in(P, i: integer, j:boolean)
Requests a tuple with name “P”, but it is also possible to
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.
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/
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
CASE STUDY (2/2)
count = 0
until EOF do
read datum from file
count = count + 1
best = 0.0
for i = 1 to count
if value > best then
best = value
for i = 1 to numworkers
until datum = "stop"
value = compare
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
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.
IMPLEMENTATIONS OF TUPLE
Jxtaspaces for P2P
W.F. Wong’s Simple C-
Linda with Posix Threads
HTML Page Spaces
Masatoshi Seki’s Rinda,
part of DistributedRuby
Ruple for Ruby
PyBrenda in Python
implementation in Python
Ruple use XML documents
instead of tuples
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/
Tuple Space Scalability
Tuple Space won’t work on the Internet, because of
its underlying “distributed shared memory” idea