Programming with exceptions in JCilk

  • Authors:
  • John S. Danaher;I.-Ting Angelina Lee;Charles E. Leiserson

  • Affiliations:
  • Computer Science and Artificial Intelligence Laboratory, Massachusetts Institute of Technology, Cambridge, MA;Computer Science and Artificial Intelligence Laboratory, Massachusetts Institute of Technology, Cambridge, MA;Computer Science and Artificial Intelligence Laboratory, Massachusetts Institute of Technology, Cambridge, MA

  • Venue:
  • Science of Computer Programming - Special issue: Synchronization and concurrency in object-oriented languages
  • Year:
  • 2006

Quantified Score

Hi-index 0.00

Visualization

Abstract

JCilk extends the serial subset of the Java language by importing the fork-join primitives spawn and sync from the Cilk multithreaded language, thereby providing call-return semantics for multithreaded subcomputations. In addition, JCilk transparently integrates Java's exception handling with multithreading by extending the semantics of Java's try and catch constructs, but without adding new keywords. This extension is "faithful" in that it obeys Java's ordinary serial semantics when executed on a single processor. When executed in parallel, however, an exception thrown by a JCilk computation causes its sibling computations to abort, which yields a clean semantics in which the enclosing cilk try block need only handle a single exception.The exception semantics of JCilk allows programs with speculative computations to be programmed easily. Speculation is essential in order to parallelize programs such as branch-and-bound or heuristic search. We show how JCilk's linguistic mechanisms can be used to program the "queens" puzzle and a parallel alpha-beta search. We have implemented JCilk's semantic model in a prototype compiler and runtime system, called JCilk-I. The compiler implements continuations in a novel fashion by introducing goto statements into Java. The JCilk-I runtime system shadows the dynamic hierarchy of cilk try blocks using a "try tree", allowing the system to chase down side computations that must be aborted. Performance studies indicate that JCilk's exception mechanism incurs minimal overhead, contributing at most a few percent on top of the cost for a spawn/return.