1 / 13

Algorithms for Implementation of Tuple Space Expert Topic ECE 1770 Spring 2003

Algorithms for Implementation of Tuple Space Expert Topic ECE 1770 Spring 2003. Ioana Burcea Won-Ho Park Electrical and Computer Engineering Department University of Toronto. Agenda. Ioana Matching Algorithms (in Linda) Basic Terminology and Concepts Multi-Key Search Algorithm Won-Ho

gyan
Download Presentation

Algorithms for Implementation of Tuple Space Expert Topic ECE 1770 Spring 2003

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Algorithms for Implementation of Tuple SpaceExpert TopicECE 1770 Spring 2003 Ioana Burcea Won-Ho Park Electrical and Computer Engineering Department University of Toronto

  2. Agenda • Ioana • Matching Algorithms (in Linda) • Basic Terminology and Concepts • Multi-Key Search Algorithm • Won-Ho • Linda: Implementation of Tuple Space

  3. Basic Terminology • Tuple (out operation) • Ex: • (1, 4.0, “Middleware”) • Template = antituple (in operation) • Ex: • (1, 4.0, ?x) x: string • (1, 4.0, “Middleware”) • Tuple arity • Ex: • (1, ?x)  arity 2 • (1, 4.0, “Middleware”)  arity 3 • Type signature • Ex: • (1, 4.0, “Middleware”)  (int, float, string)

  4. Matching Algorithms • Exhaustive search – too time consuming • Optimizations • Segmenting • Orthogonal subspaces • Based on • tuple arity & type signature • constants • Treated separately • Searching • Zero variable case • In(“mutex”) Out(“mutex”) • One variable case • Single key index • Multiple variable • Multiple key search

  5. Patterns • Actual parameter • Ex: • (1, 4.0, “Middleware”)  1, 4.0, “Middleware” • (1, 4.0, x)  1, 4.0, x • Formal parameter (placeholder / wildcard) • Ex: • ?x (x: string) • Tuple Pattern • Bitvector • its size is given by the arity of the tuple • a bit is set if and only if it corresponds to a actual parameter • Ex: • (1, 4.0, “Middleware”)  (111) • (1, 4.0. ?x)  (110)

  6. Matching Semantics Using Patterns • Compatible patterns • Two tuples P and Q are compatible if and only if P OR Q contains only 1s • Two tuples may match if and only if their patterns are compatible • Must-match pattern • Ex: • Out(a, b, c)  pattern (111) • In (x, ?y, z)  pattern (101) • Matching definition • Two tuples match if and only if • They have the same type signature • Exactly one is an antituple • Their patterns are compatible • Their must-match values are equal OR = (111)  compatible AND = (101)  must-match pattern

  7. Multiple key search • Applied inside each orthogonal subspace • Basic idea: • Build the key search based on the pairs of compatible patterns and must-match values • Ex: • Tuple pattern: (111) • Antituple patterns: (010), (100), (110) • an entry in the dictionary for each pair (tupple pattern, antituple pattern) => each tuple will be referenced by multiple keys • the key of the entry also contains the must-match values • the entry points to the tuple • Ex: out(3, 5, x) => Key: (010:111:5) • ! One record per must-match pattern is not sufficient ! • Property: • If two tuples have the same key => they match • Perfect hash function – one to one correspondence between search keys and the hash keys

  8. Offline Algorithm – in operation 1) Lock subspace 2) Identify antituple’s pattern, p, and store antituple where it can be found via a pointer or other reference. 3) For each compatible tuple pattern, c, in use, 4) Combine p, c, and antituple’s must-match values to form a search key, k. 5) Search dictionary for a tuple reference indexed by k. 6) If one is found, then 7) Delete tuple, antituple and all their references. 8) Goto 10. else 9) Insert a reference to antituple, indexed by k, into dictionary. 10) Unlock subspace 11) If no match was found, then 12) Suspend execution until signalled else 13) Return match result

  9. Online Algorithm • Adapt the tuple space whenever a new pattern is encountered 2.1) If p is a new antituple pattern, then 2.2) Create a new list for p 2.3) For each old, compatible tuple pattern q 2.4) For each tuple t on q’s list 2.5) Insert into dictionary a new reference to t, based on p and q 2.6) Insert antituple in p’s list • Discussion • Usually, no perfect hash • Each hash entry has a hash chain • The hash chain has to be checked until a match is found

  10. Virtual Linda Machine (VLM):Implementation of Linda on Networks • TupleSpaces is a virtually shared memory: • How to implement TupleSpaces in the absence of shared memory • How to find Tuples and where keep them • Components of VLM • Hardware • Network Communication Kernel • Compiler • Hardware is networks, or network computers • The kernel is the program resident on each network node that implements inter-node communication • Performing In(), out(), read() primitive instructions on networks by sending or broadcasting messages • The compiler adds code for maintaining buffer (shared memory)

  11. Run-Time Name Resolution in VLM:How to find Tuples • VLM should provide Name(Tuple)-to-Node(address) mapping information • Centralized in directory nodes • Distributed network-wide (e.g., by means of a network-wide broadcast) • The communication kernel translates Tuple-names into network-addresses on a per-reference basis • Network state and its storage • Only one node generating state information maintains the state • All nodes maintain all state by broadcasting • VLM uses N1/2-Node Broadcast Technique.

  12. N1/2-Node Broadcast Techniqueand Name Resolution • Write set : row nodes • Read set : column nodes • P-in-thread process • P-out-thread process • P-in-thread is intercepted by a P-out-thread on node k. • A notification message is generated on k-node, and sent to m-node • The message instructs m-node to send tuple(P…) to n-node. A Network Topology P-out-thread m Out(P…) P-in-thread k n In(P…)

  13. Buffering:Where to keep Tuples • VLM is required to simulate Linda’s infinite global buffer • Buffer is allocated by the compiler-generated code, not by the kernel • in(P….) : allocating a buffer on the execution stack of the process, and referred to buffer P. • out(P…) : Tuples are stored in per-process heaps, and destroyed when it is delivered • Header information required by the communication system • If a process terminates with undelivered Tuples • The buffers are maintained by the communication kernel until delivery occurs

More Related