Safer Tuple Spaces

Safer Tuple Spaces

Safer Tuple Spaces 1 2 3 Ro el van der Go ot Jonathan Schaeer and Gregory V Wilson 1 Erasmus University Rotterdam The Netherlands vandergo otfeweurnl 2 University of Alb erta Canada jonathancsualb ertaca 3 Visible Decisions Canada gregvizbizcom Abstract The simplicity and elegance of the Linda programming mo del is based on its single global typ eless tuple space However these virtues come at a cost First the tuple space can b e an imp ediment to scalable high p erformance Second the black b ox nature of the tuple space makes it an inherently dangerous data structure prone to many typ es of programming errors Blossom is a C version of Linda with extensions This pap er intro duces some of the novelties in Blossom as they p ertain to creating safe tuple spaces These new features include multiple strongly typ ed tuple spaces eld access patterns tuple space access patterns and assertions Intro duction The computing literature is replete with programming mo dels for writing par allel programs Many of them are research prototyp es that are go o d enough for a few academic pap ers and then quietly disapp ear Few mo dels attract sus tained interest in the literature or establish a large user community Linda is one of the rare parallel programming mo dels that has managed to survive for over a decade in spite of the discriminating and critical tastes of the parallel computing community Lindas strength is the simplicity of its programming mo del In eect Linda oers a blackb oard the tuple space that pro cesses can read from write to and erase p ortions of To supp ort Linda languages such as C C and Fortran need only have a library implementing a few calls to access the tuple space Thus a simple implementation is easily built More sophisticated versions of Linda exist relying on compiler techniques to understand the parallelism in the application and optimize accordingly Although the uniqueness of the Linda approach excited the parallel comput ing community in the late s with time the novelty waned In part this was b ecause Linda b ecame a commercial pro duct with the resulting licensing fees and free versions suered in p erformance Nevertheless there continues to b e an active Linda user community Although there are many advantages to the Linda mo del simplicity ease of integration in a language ease of expressing communication and synchroniza tion there are two ma jor criticisms First and foremost the tuple space is often seen to b e a b ottleneck and an imp ediment to high scalable p erformance For many applications these p erformance concerns eectively rule out Linda as a viable to ol Second an often overlo oked p oint is that the tuple space has some dangerous design aws that can give rise to serious programming errors The tuple space is a generic shared data structure that can b e viewed as a black b ox one can read and write to it but an application cannot see inside it It is legal to put anything into the tuple space including semantically invalid data Fur thermore there is no way to p eek into this black b ox to see its internal structure and check for errors Thus to make Linda a more attractive parallel program ming mo del two things must b e addressed improved program p erformance and making the mo del safer in the sense that the likeliho o d of programming errors is reduced This pap er intro duces Blossom an extended version of Linda for the C programming language designed to address the ma jor concerns of Linda This pap er describ es some of the innovations in Blossom that inuence the structure of the tuple space By appropriately sp ecifying tuple spaces the probability of intro ducing a programming error into a parallel Blossom program is greatly reduced Parallel programs are notoriously dicult to design implement test and debug Anything that can b e done to shorten the program development cycle is welcome Although the enhancements describ ed in this pap er address the software engineering concerns of generating correct programs most of them also can b e used to improve program p erformance Since CLinda and FortranLinda made their debut there has b een a ma jor shift in programming language trends Strong typing and class libraries as in C and Java have increased the expressive p ower available to the programmer In particular these features and C templates allow us to achieve many of the capabilities of a Linda compiler using just a standard C compiler without intro ducing new syntax or changing the semantics of the programming language The Linda mo del can easily b e integrated into an ob ject oriented program ming language Linda implementations for Eiel and Java require the user to explicitly create ob jects of class Tuple In C Linda a precom piler is required to translate new syntax into C Our Blossom system neither needs explicit creation of ob jects of class Tuple nor do es it use a precompiler Section describ es the Linda mo del and intro duces some of the prop osed mo del enhancements in the literature Section describ es four innovations in Blossom The pap er is restricted to discussing the design of the tuple space since these enhancements are currently implemented and working Section il lustrates programming using Blossom Finally Section discusses Blossom work in progress including the p erformance enhancements Linda Linda was intro duced in Although the Linda mo del was not in its nal form it contained the idea of a global memory accessible by multiple pro cesses The global memory contains a collection of data records called tuples and it is accordingly called the tuple space Tuple space data is organized as an asso ciative memory meaning that data is retrieved by its values not by an index Linda provides six simple op erations to access the tuple space Op eration in gets a tuple from the tuple space in the program out puts a tuple out of the program into the tuple space and rd replicates a tuple The rd op eration is semantically equivalent to an in immediately followed by an out combined in one atomic action The following example illustrates how a program might manipulate the tuple space An outtodo puts a tuple with two elds into the tuple space the rst eld is a string with value todo and the second eld is an integer with value A variable with value as the second eld would have the same result An intodo will get the same tuple out of the tuple space if it is present If there is no tuple with values equivalent to all the arguments the op eration will blo ck until another pro cess puts a matching tuple in the tuple space Wild cards can b e used to enhance the capabilities of the op erations that read tuples For example int i intodo i matches any tuple with two elds the rst b eing a string with value todo and the second an integer with any value Such a wild card eld i is called a formal parameter as opp osed to an actual parameter a value eld Tuples that contain formal elds are sometimes referred to as antituples Linda provides an eval op eration for spawning new pro cesses For example evaltodo sqr will spawn two pro cesses each evaluating one of the arguments in parallel with the spawning pro cess As so on as all the arguments of the eval are evaluated the resulting tuple is put into tuple space the tuple todo in this case The op erations inp and rdp are nonblo cking versions of in and rd resp ec tively They query the tuple space for a match and return a b o olean indicating whether they succeeded in that If no match is found the op erations will not wait ie blo ck for another pro cess to insert a matching tuple Because the mo del is so simple and elegant it is easy to nd fault with it Consequently numerous extensions to the mo del have b een prop osed in the literature Some of the more interesting ones include having multiple tu ple spaces more p owerful tuple space op erations such as collect and copycollect sp ecifying access patterns on tuples p ersistent tuple spaces faulttolerant tuple spaces and op en Linda In this pap er we will use the extension of multiple tuple spaces This pap er discusses Blossom a Cbased implementation of Linda with extensions Since we are using only the C compiler and not a Linda compiler the syntax of Blossom diers slightly from that of Linda In Blossom tuple spaces b ecome ob jects and the op erations on tuple spaces b ecome memb er functions The original Linda op erations are relative to the program the Blossom memb er functions are relative to the tuple space Hence new names for the op erations had to b e chosen out b ecomes put in b ecomes get rd b ecomes copy inp b ecomes get nb and rdp b ecomes copy nb where nb indicates the call is nonblo cking The eval op eration is handled as a sp ecial case of put eval sqr b ecomes ts is the name of a userdefined tuple space tsput evalsqr indicating that only one pro cess is created to evaluate the square of Formal parameters are handled dierently as well int i in i b ecomes Argint i tsget ivar where Argtype is a Blossom class that enhances the type to include additional metho ds The var metho d allows the variable to b e used as a wild card Blossoms tuple spaces are rst class ob jects which means that it is p ossible to have tuple spaces of tuple spaces Enhancements The tuple space is a typ eless black b ox The user can put data of any typ e in it and attempt to extract data of any typ e from it But the wealth of program ming language design exp erience suggests that this is a bad idea The trend in computing to day is towards strong typing We have seen the evolution of BCPL to C to C motivated in part

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    13 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us