Programming with exceptions in JCilk

Programming with exceptions in JCilk
复制标题

在 JCIlk 中进行异常编程

DOI:
10.1016/j.scico.2006.05.008
复制
发表时间:
2006
期刊:
Sci. Comput. Program.
影响因子:
--
通讯作者:
C. Leiserson
C. Leiserson
中科院分区:
--
文献类型:
--
作者:
John S. Danaher;I. Lee;C. Leiserson

文献摘要

被引文献

相似文献

JCilk通过从Cilk多线程语言导入fork-join原语spawn和sync来扩展Java语言的串行子集,从而为多线程子计算提供调用返回语义。此外,JCilk通过扩展Java的try和catch结构的语义,透明地将Java的异常处理与多线程集成在一起,但不添加新的关键字。这个扩展是“忠实的”,因为它在单个处理器上执行时遵守Java的普通串行语义。然而,当并行执行时,JCilk计算抛出的异常会导致其兄弟计算中止,这会产生一个干净的语义,其中封闭的cilk try块只需要处理单个异常。JCilk的异常语义允许对具有推测计算的程序进行轻松编程。推测是必不可少的,以并行程序,如分支定界或启发式搜索。我们展示了如何JCilk的语言机制可以用来编程的“皇后”难题和并行的α-β搜索。我们已经实现了JCilk的语义模型的原型编译器和运行时系统,称为JCilk-1。编译器通过在Java中引入后藤语句以一种新颖的方式实现延续。JCilk-1运行时系统使用“try树”隐藏cilk try块的动态层次结构,允许系统追踪必须中止的侧计算。性能研究表明,JCilk的异常机制引起的开销最小,最多只占spawn/return开销的几个百分点。
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-1. The compiler implements continuations in a novel fashion by introducing goto statements into Java. The JCilk-1 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.