Capsule-oriented Programming

By: Hridesh Rajan, Steven M. Kautz, Eric Lin, Sarah Kabala, Ganesha Upadhyaya, Yuheng Long, Rex Fernando, and Loránd Szakács

PDF Download Download Paper

Abstract

Many programmers find writing and reasoning about concurrent programs difficult and can benefit from better abstractions for concurrency. A promising class of such concurrency abstractions combines state and control within a single linguistic mechanism and uses asynchronous messages for communications, e.g. active objects or actors. One hurdle is the need to adapt to an asychronous style of programming. We believe that most benefits of actor-like abstractions can be brought to sequentially-trained programmers via a more familiar synchronous model. We call this model capsule-oriented programming, where programmers describe a system in terms of its modular structure and write sequential code to implement the operations of those modules using a new abstraction that we call capsule. Capsule-oriented programs look like familiar sequential programs but they are implicitly concurrent. We present Panini, a capsule-oriented programming language, and its compiler, which help programmers avoid two classes of concurrency errors: sequential inconsistency and data races due to sharing. We have refactored the Java Grande and NPB benchmarks (>134,000 LOC) using Panini, leading to simpler and shorter programs that perform as well as the parallel versions provided with the benchmarks.

ACM Reference

Rajan, H. et al. 2013. Capsule-oriented Programming. Technical Report #13-01. Iowa State U., Computer Sc.

BibTeX Reference

@techreport{rajan2013capsule,
  author = {Hridesh Rajan and Steven M. Kautz and Eric Lin and Sarah Kabala and Ganesha Upadhyaya and Yuheng Long and Rex Fernando, and Lor\'{a}nd Szak\'{a}cs},
  title = {Capsule-oriented Programming},
  institution = {Iowa State U., Computer Sc.},
  year = {2013},
  number = {13-01},
  abstract = {
    Many programmers find writing and reasoning about concurrent programs
    difficult and can benefit from better abstractions for concurrency. A
    promising class of such concurrency abstractions combines state and control
    within a single linguistic mechanism and uses asynchronous messages for
    communications, e.g. active objects or actors. One hurdle is the need to adapt
    to an asychronous style of programming. We believe that most benefits of
    actor-like abstractions can be brought to sequentially-trained programmers via
    a more familiar synchronous model. We call this model capsule-oriented
    programming, where programmers describe a system in terms of its modular
    structure and write sequential code to implement the operations of those
    modules using a new abstraction that we call capsule. Capsule-oriented
    programs look like familiar sequential programs but they are implicitly
    concurrent. We present Panini, a capsule-oriented programming language, and
    its compiler, which help programmers avoid two classes of concurrency errors:
    sequential inconsistency and data races due to sharing. We have refactored the
    Java Grande and NPB benchmarks (>134,000 LOC) using Panini, leading to simpler
    and shorter programs that perform as well as the parallel versions provided
    with the benchmarks.
  }
}