Safe Parallel Programming with Session Java

  • Nicholas Ng
  • Nobuko Yoshida
  • Olivier Pernet
  • Raymond Hu
  • Yiannos Kryftis
Part of the Lecture Notes in Computer Science book series (LNCS, volume 6721)

Abstract

The session-typed programming language Session Java (SJ) has proved to be an effective tool for distributed programming, promoting structured programming for communications 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. We demonstrate that the new primitives yield clearer and safer code for pipeline, ring and mesh topologies through implementations of representative parallel algorithms. We then present a semantics and session typing system including the new primitives, and prove type soundness and deadlock-freedom for our implementations. The benchmark results show that the new SJ is substantially faster than the original SJ and performs competitively against MPJ Express used as reference.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 1.
    Bejleri, A., Hu, R., Yoshida, N.: Session-Based Programming for Parallel Algorithms. In: PLACES, EPTCS (2009)Google Scholar
  2. 2.
    Bocchi, L., Honda, K., Tuosto, E., Yoshida, N.: A theory of design-by-contract for distributed multiparty interactions. In: Gastin, P., Laroussinie, F. (eds.) CONCUR 2010. LNCS, vol. 6269, pp. 162–176. Springer, Heidelberg (2010)CrossRefGoogle Scholar
  3. 3.
    Casanova, H., Legrand, A., Robert, Y.: Parallel Algorithms. Chapman & Hall, Boca Raton (2008)MATHGoogle Scholar
  4. 4.
    Deniélou, P.-M., Yoshida, N.: Dynamic Multirole Session Types. In: POPL 2011, pp. 435–446. ACM, New York (2011)Google Scholar
  5. 5.
  6. 6.
    Gay, S.J., Vasconcelos, V.T., Ravara, A., Gesbert, N., Caldeira, A.Z.: Modular Session Types for Distributed Object-Oriented Programming. In: POPL 2010, pp. 299–312. ACM, New York (2010)Google Scholar
  7. 7.
    Gropp, W., Lusk, E., Skjellum, A.: Using MPI: Portable Parallel Programming with the Message-Passing Interface. MIT Press, Cambridge (1999)MATHGoogle Scholar
  8. 8.
    Honda, K., Vasconcelos, V.T., Kubo, M.: Language Primitives and Type Discipline for Structured Communication-Based Programming. In: Hankin, C. (ed.) ESOP 1998. LNCS, vol. 1381, pp. 122–138. Springer, Heidelberg (1998)CrossRefGoogle Scholar
  9. 9.
    Honda, K., Yoshida, N., Carbone, M.: Multiparty Asynchronous Session Types. In: POPL, pp. 273–284. ACM, New York (2008)Google Scholar
  10. 10.
    Hu, R.: Structured, Safe and High-level Communications Programming with Session Types. PhD thesis, Imperial College London (2010)Google Scholar
  11. 11.
    Hu, R., Kouzapas, D., Pernet, O., Yoshida, N., Honda, K.: Type-Safe Eventful Sessions in Java. In: D’Hondt, T. (ed.) ECOOP 2010. LNCS, vol. 6183, pp. 329–353. Springer, Heidelberg (2010)CrossRefGoogle Scholar
  12. 12.
    Hu, R., Yoshida, N., Honda, K.: Session-Based Distributed Programming in Java. In: Vitek, J. (ed.) ECOOP 2008. LNCS, vol. 5142, pp. 516–541. Springer, Heidelberg (2008)CrossRefGoogle Scholar
  13. 13.
  14. 14.
    MPJ Express homepage, http://mpj-express.org/
  15. 15.
    Ng, N.: High Performance Parallel Design based on Session Programming. MEng thesis, Department of Computing, Imperial College London (2010)Google Scholar
  16. 16.
    Shafi, A., Carpenter, B., Baker, M.: Nested Parallelism for Multi-core HPC Systems using Java. Journal of Parallel and Distributed Computing 69(6), 532–545 (2009)CrossRefGoogle Scholar
  17. 17.
    Sivaramakrishnan, K.C., Nagaraj, K., Ziarek, L., Eugster, P.: Efficient Session Type Guided Distributed Interaction. In: Clarke, D., Agha, G. (eds.) COORDINATION 2010. LNCS, vol. 6116, pp. 152–167. Springer, Heidelberg (2010)CrossRefGoogle Scholar
  18. 18.
    Spring, J.H., Privat, J., Guerraoui, R., Vitek, J.: StreamFlex: High-Throughput Stream Programming in Java. In: OOPSLA 2007, pp. 211–228. ACM, New York (2007)Google Scholar
  19. 19.
    Vo, A., Vakkalanka, S., DeLisi, M., Gopalakrishnan, G., Kirby, R.M., Thakur, R.: Formal Verification of Practical MPI Programs. In: PPoPP 2009, pp. 261–270. ACM, New York (2009)Google Scholar
  20. 20.
    Yoshida, N., Deniélou, P.-M., Bejleri, A., Hu, R.: Parameterised Multiparty Session Types. In: Ong, C.-H.L. (ed.) FOSSACS 2010. LNCS, vol. 6014, pp. 128–145. Springer, Heidelberg (2010)CrossRefGoogle Scholar
  21. 21.
    Yoshida, N., Vasconcelos, V.T.: Language Primitives and Type Discipline for Structured Communication-Based Programming Revisited: Two Systems for Higher-Order Session Communication. ENTCS 171(4), 73–93 (2007)Google Scholar

Copyright information

© IFIP International Federation for Information Processing 2011

Authors and Affiliations

  • Nicholas Ng
    • 1
  • Nobuko Yoshida
    • 1
  • Olivier Pernet
    • 1
  • Raymond Hu
    • 1
  • Yiannos Kryftis
    • 2
  1. 1.Imperial College LondonUK
  2. 2.National Technical University of AthensGreece

Personalised recommendations