# Safe Parallel Programming with Session Java

Olivier Pernet, Nicholas Ng, Raymond Hu, Nobuko Yoshida, and Yiannos Kryftis.

Submitted paper [pdf]. 8 October 2010.

Extended version [pdf]. 26 October 2010. Imperial College DoC Technical Report DTR10-14. Includes detailed proofs, an additional safety and deadlock-freedom result for a wraparound mesh topology, and a more extensive survey of related work.

## Abstract

The session-typed programming language Session Java (SJ) has proved to be an effective tool for distributed programming, promoting productivity and compile-time safety. This paper investigates the use of SJ for session-typed parallel programming, and introduces new language primitives for chained iteration and multi-channel communication. These primitives allow the efficient coordination of parallel computation across multiple processes, thus enabling SJ to express the complex communication topologies often used by parallel algorithms with static safety guarantees. We demonstrate that the new primitives yield clearer and safer code for pipeline, ring and mesh topologies, and through implementations of a parallel Jacobi method and an n-Body simulation. We then present a semantics and session typing system including the new primitives, and prove type soundness and deadlock-freedom for our parallel algorithm implementations. Finally, we benchmark several implementations of the n-Body simulation on a hybrid computing cluster, demonstrating the performance gains due to the new primitives. The SJ implementation is also substantially faster than an MPJ Express implementation used as reference.

## Session Java

The SJ compiler and runtime are available on Google Code. Additional information about SJ, including previous publications, can be found here.

## Related Master's theses

- Nick Ng. High performance parallel design based on session programming. June 2010.
- Yiannos Kryftis. Session-based Programming for Message-Passing-based Parallel Algorithms. September 2009.

## Detailed benchmark results