Capsule-oriented Programming

By: Hridesh Rajan

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. 2015. Capsule-oriented Programming. 37th IEEE/ACM International Conference on Software Engineering, ICSE, Florence, Italy (2015), 611–614.

BibTeX Reference

@inproceedings{RajanETAL2013,
  author = {Hridesh Rajan},
  title = {Capsule-oriented Programming},
  booktitle = {37th IEEE/ACM International Conference on Software Engineering, ICSE, Florence, Italy},
  pages = {611--614},
  year = {2015},
  publisher = {{IEEE} Computer Society},
  editor = {Antonia Bertolino and Gerardo Canfora and Sebastian G. Elbaum},
  doi = {10.1109/ICSE.2015.205},
  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.},
}