Linda Coordination Language - PowerPoint PPT Presentation

About This Presentation
Title:

Linda Coordination Language

Description:

Linda. Parallel coordination language. Virtual shared memory system on heterogeneous networks ... intuitive, but minimal Security. Linda is not fault-tolerant ... – PowerPoint PPT presentation

Number of Views:354
Avg rating:3.0/5.0
Slides: 22
Provided by: taek
Category:

less

Transcript and Presenter's Notes

Title: Linda Coordination Language


1
Linda Coordination Language
  • Presented by
  • Tae Ki Kim
  • Tae_at_udel.edu

2
Outline
  • Linda
  • C-Linda
  • Java Space

3
Linda
  • Parallel coordination language
  • Virtual shared memory system on heterogeneous
    networks
  • Associative addressing through efficient hashing
  • Simple language primitives allow minimal code
    rewriting
  • In(), Out() moves tuples to/from TupleSpace
  • Eval() spawns processes in Tuplespace
  • Rd() does non-destructive reads in T.S.
  • Inp(), Rdp() are non-blocking versions of In()
    and Rd()

4
Tuplespace
5
C-Linda Language
  • The C-Linda programming language is the
    combination of the C and the Linda language.
  • The C-Linda is one realization of the Linda
    model.
  • The C-Linda supports six Linda functions.

6
C-Linda Functions
  • Out(t) causes tuple t to be added to tuple
    space
  • Out(a string, 15.01, 17, x)
  • Out(0, 1)
  • In(s) causes some tuple t that matches
    anti-tuple s to be withdrawn from tuple space.
  • In(a string, ? F, ? I, y)

7
C-Linda Functions
  • Rd(s) is the same as in(s) except that the
    matched tuple remains in tuple space.
  • Eval(t) is the same as out(t), except that it
    sends an active tuple into Tuplespace.
  • For example,
  • out(foo, 3, 4.3)
  • Eval(factorial, 7, fact(7))

8
C-Linda Functions
  • Inp and Rdp predicate versions of in and rd,
    attempt to locate a matching tuple and return 0
    if they fail otherwise they return 1.

9
Example of Tuple matching
  • N-element vector stored as n tuples in the Tuple
    space
  • (V, 1, FirstElt)
  • (V, 2, SecondElt)
  • (V, n, NthElt)
  • To read the jth element and assign it to x, use
  • Rd(V, j, ?x)

10
/ hello.clc a simple C-Linda program /
include "linda.h" int worker(int num)
int i for (i0 iltnum i)
out("hello, world") return 0 int
real_main(int argc, char argv) int
result eval("worker", worker(5))
in("hello, world") in("hello, world")
in("hello, world") in("hello, world")
in("hello, world") in("worker", ? result)
return 0
11
Benefits of C-Linda
  • Anonymous and asynchronous communication
  • Associative addressing / pattern matching
  • Data persistence independent of creator
  • Simple API ? less and easier coding
  • Ease of code transformation

12
C-Linda Limitations
  • High system overhead
  • Designed as parallel computing model, primarily
    for LANs
  • Lack of security model
  • Lack of transaction semantics
  • Language specific implementation
  • Blocking calls, but no notification mechanism

13
JavaSpaces (Sun Micro)
  • Lightweight infrastructure for network
    applications
  • Distributed functionality implemented through RMI
  • Entries written to/from JavaSpace with write,
    read
  • notify notifies client of incoming entries w/
    timeout

14
JavaSpace
  • Pattern Matching done to templates with class
    type comparisons, no comparison of literals.
  • Transaction mechanism with a two phase commit
    model
  • Entries are writtern with a lease, so limited
    persistence with time-outs.

15
package examples.spaces import
net.jini.impl.outrigger.binders.RefHolder
import net.jini.lease.Lease import
net.jini.space.JavaSpace import
net.jini.transaction.Transaction import
java.rmi.Naming import java.rmi.RMISecurityManag
er public class HelloWorld / Get a
remote reference to a particular space / public
JavaSpace getSpace() try //
RefHolderImpl is the remote object registered
with // the registry //
RefHolder rh (RefHolder)Naming.lookup("JavaSpac
e") // Use the RefHolder's proxy
method to get the space // reference
// JavaSpace js (JavaSpace)rh.proxy
() return js catch (Exception
e) System.err.println(e.getMessage())
return null
16
public static void main(String args)
// Set a security manager so that the MyEntry
class // can be downloaded from this
codebase to the server // if
(System.getSecurityManager() null)
System.setSecurityManager(new RMISecurityManager()
) // Create an instance of this
class to call the getSpace // method
JavaSpace space (new HelloWorld()).getSpace()
System.out.println("Got a remote reference"
"to a JavaSpace implementation") //Create
an Entry to write in to the space //
MyEntry msg new MyEntry() msg.content
"Howdy"
17
// The transaction under which to perform the
write // Transaction txn null
// The lease duration that should be requested
for // this entry long timeToLive
Lease.FOREVER try
space.write(msg, txn, timeToLive)
System.out.println("Wrote an Entry to the
space") MyEntry template new
MyEntry() // Set attribute to be null,
so it will act as a // wildcard and
match on any MyEntry //
template.content null
System.out.println("Created a template")

18
// The amount of time to wait for a match
// long timeToWait 0L
// The transaction under which to perform the
read // Transaction sotxn
null MyEntry result (MyEntry)
space.read (template, sotxn, timeToWait)
System.out.println("Read the an Entry from the
space") String valueToPrint ""
valueToPrint result.content
System.out.println("And the result was "
valueToPrint) catch (Exception e)
e.printStackTrace(System.err)
System.exit(0)
19
JavaSpace Limitations
  • Simplicity of or lack of security model
  • Java RMI performance bottleneck
  • Currently only a specification exists, but no
    implementation

20
More Tuple Space Implemetations
  • Java Messaging Service(JMS), a Message-Oriented
    Middleware (MOM) layer API, shares many of the
    same architectural strengths of JavaSpaces while
    offering some added benefits.
  • Tspaces (IBM Almaden)
  • PageSpace and JADA
  • LIME
  • XML Dataspaces
  • Mobile Agent Reactive Space(MARS)

21
Conclusion
  • "Space-based" architectures are extremely
    flexible, providing most of the core
    infrastructure necessary to support distributed,
    mobile, and intelligent software agents.
  • The language is although intuitive, but minimal
    Security.
  • Linda is not fault-tolerant
Write a Comment
User Comments (0)
About PowerShow.com