Multiparty Session C: Safe Parallel Programming with Message Optimisation

  • Nicholas Ng
  • Nobuko Yoshida
  • Kohei Honda
Part of the Lecture Notes in Computer Science book series (LNCS, volume 7304)


This paper presents a new efficient programming toolchain for message-passing parallel algorithms which can fully ensure, for any typable programs and for any execution path, deadlock-freedom, communication safety and global progress through a static checking. The methodology is embodied as a multiparty session-based programming environment for C and its runtime libraries, which we call Session C. Programming starts from specifying a global protocol for a target parallel algorithm, using a protocol description language. From this global protocol, the projection algorithm generates endpoint protocols, based on which each endpoint C program is designed and implemented with a small number of concise session primitives. The endpoint protocol can further be refined to a more optimised protocol through subtyping for asynchronous communication, preserving original safety guarantees. The underlying theory can ensure that the complexity of the toolchain stays in polynomial time against the size of programs. We apply this framework to representative parallel algorithms with complex communication topologies. The benchmark results show that Session C performs competitively against MPI.


Parallel Algorithm Session Type Runtime Library Parallel Pipeline Global Progress 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
  2. 2.
  3. 3.
    Bettini, L., Coppo, M., D’Antoni, L., De Luca, M., Dezani-Ciancaglini, M., Yoshida, N.: Global Progress in Dynamically Interleaved Multiparty Sessions. In: van Breugel, F., Chechik, M. (eds.) CONCUR 2008. LNCS, vol. 5201, pp. 418–433. Springer, Heidelberg (2008)CrossRefGoogle Scholar
  4. 4.
    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
  5. 5.
    Carter, J., Gardner, W.B., Grewal, G.: The Pilot approach to cluster programming in C. In: IPDPSW, pp. 1–8. IEEE (2010)Google Scholar
  6. 6.
    Casanova, H., Legrand, A., Robert, Y.: Parallel Algorithms. Chapman & Hall (July 2008)Google Scholar
  7. 7.
    Danalis, A., et al.: MPI-aware compiler optimizations for improving communication-computation overlap. In: ICS 2009, pp. 316–325 (2009)Google Scholar
  8. 8.
    Deniélou, P.M., Yoshida, N.: Buffered Communication Analysis in Distributed Multiparty Sessions. In: Gastin, P., Laroussinie, F. (eds.) CONCUR 2010. LNCS, vol. 6269, pp. 343–357. Springer, Heidelberg (2010)CrossRefGoogle Scholar
  9. 9.
    Deniélou, P.M., Yoshida, N.: Dynamic multirole session types. In: POPL, pp. 435–446. ACM (2011)Google Scholar
  10. 10.
    Deniélou, P.M., Yoshida, N.: Multiparty Session Types Meet Communicating Automata. In: Seidl, H. (ed.) Programming Languages and Systems. LNCS, vol. 7211, pp. 194–213. Springer, Heidelberg (2012)CrossRefGoogle Scholar
  11. 11.
  12. 12.
    Friedley, A., Lumsdaine, A.: Communication Optimization Beyond MPI. In: IPDPSW and Phd Forum. IEEE (2011)Google Scholar
  13. 13.
  14. 14.
    Grama, A., Karypis, G., Kumar, V., Gupta, A.: Introduction to Parallel Computing, 2nd edn. Addison Wesley (January 2003)Google Scholar
  15. 15.
    Gropp, W., Lusk, E., Skjellum, A.: Using MPI: Portable Parallel Programming with the Message-Passing Interface. MIT Press (1999)Google Scholar
  16. 16.
    Honda, K., Mukhamedov, A., Brown, G., Chen, T.-C., Yoshida, N.: Scribbling Interactions with a Formal Foundation. In: Natarajan, R., Ojo, A. (eds.) ICDCIT 2011. LNCS, vol. 6536, pp. 55–75. Springer, Heidelberg (2011)CrossRefGoogle Scholar
  17. 17.
    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
  18. 18.
    Honda, K., Yoshida, N., Carbone, M.: Multiparty asynchronous session types. In: POPL 2008, vol. 5201, p. 273 (2008)Google Scholar
  19. 19.
    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
  20. 20.
    Hu, R., Yoshida, N., Honda, K.: Session-Based Distributed Programming in Java. In: Ryan, M. (ed.) ECOOP 2008. LNCS, vol. 5142, pp. 516–541. Springer, Heidelberg (2008)CrossRefGoogle Scholar
  21. 21.
    Jim, T., Morrisett, G., Grossman, D., Hicks, M., Cheney, J., Wang, Y.: Cyclone: A Safe Dialect of C. In: Usenix Annual Technical Conference, Monterey, CA (2002)Google Scholar
  22. 22.
    Lattner, C., Adve, V.S.: LLVM: A Compilation Framework for Lifelong Program Analysis & Transformation. In: CGO 2004, pp. 75–88 (2004)Google Scholar
  23. 23.
    Leighton, F.T.: Introduction to parallel algorithms and architectures: arrays, trees, hypercubes. Morgan Kaufmann (1991)Google Scholar
  24. 24.
  25. 25.
    Mostrous, D.: Session Types in Concurrent Calculi: Higher-Order Processes and Objects. Ph.D. thesis, Imperial College London (2009)Google Scholar
  26. 26.
    Mostrous, D., Yoshida, N., Honda, K.: Global Principal Typing in Partially Commutative Asynchronous Sessions. In: Castagna, G. (ed.) ESOP 2009. LNCS, vol. 5502, pp. 316–332. Springer, Heidelberg (2009)CrossRefGoogle Scholar
  27. 27.
  28. 28.
    MPJ Express homepage,
  29. 29.
    Ng, N., Yoshida, N., Pernet, O., Hu, R., Kryftis, Y.: Safe Parallel Programming with Session Java. In: De Meuter, W., Roman, G.-C. (eds.) COORDINATION 2011. LNCS, vol. 6721, pp. 110–126. Springer, Heidelberg (2011)CrossRefGoogle Scholar
  30. 30.
    Occam-pi homepage,
  31. 31.
    Scribble homepage,
  32. 32.
    Siegel, S.F., Zirkel, T.K.: Automatic formal verification of MPI-based parallel programs. In: PPoPP 2011, p. 309. ACM Press (February 2011)Google Scholar
  33. 33.
    Villard, J.: Heaps and Hops. Ph.D. thesis, ENS Cachan (2011)Google Scholar
  34. 34.
    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 (2009)Google Scholar
  35. 35.
    Vo, A., et al.: A Scalable and Distributed Dynamic Formal Verifier for MPI Programs. In: SC 2010, pp. 1–10. IEEE (2010)Google Scholar
  36. 36.
    Yoshida, N., Deniélou, P.-M., Bejleri, A., Hu, R.: Parameterised Multiparty Session Types. In: Ong, L. (ed.) FOSSACS 2010. LNCS, vol. 6014, pp. 128–145. Springer, Heidelberg (2010)CrossRefGoogle Scholar
  37. 37.
    ZeroMQ homepage,

Copyright information

© Springer-Verlag Berlin Heidelberg 2012

Authors and Affiliations

  • Nicholas Ng
    • 1
  • Nobuko Yoshida
    • 1
  • Kohei Honda
    • 2
  1. 1.Imperial College LondonUK
  2. 2.Queen MaryUniversity of LondonUK

Personalised recommendations