Session Types for Functional Multithreading

  • Vasco Vasconcelos
  • António Ravara
  • Simon Gay
Part of the Lecture Notes in Computer Science book series (LNCS, volume 3170)


We define a language whose type system, incorporating session types, allows complex protocols to be specified by types and verified by static typechecking. A session type, associated with a communication channel, specifies the state transitions of a protocol and also the data types of messages associated with transitions; thus typechecking can verify both correctness of individual messages and correctness of sequences of transitions. Previously session types have mainly been studied in the context of the π-calculus; instead, our formulation is based on a multi-threaded functional language with side-effecting input/output operations. Our typing judgements statically describe dynamic changes in the types of channels, our channel types statically track aliasing, and our function types not only specify argument and result types but also describe changes in channels. We formalize the syntax, semantics and typing rules of our language, and prove subject reduction and runtime type safety theorems.


Session types static typechecking concurrent programming specification of communication protocols 


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Chaki, S., Rajamani, S.K., Rehof, J.: Types as models: model checking message-passing programs. In: POPL, pp. 45–57. ACM Press, New York (2002)Google Scholar
  2. 2.
    DeLine, R., Fähndrich, M.: Enforcing high-level protocols in low-level software. In: PLDI, pp. 59–69. ACM Press, New York (2001)Google Scholar
  3. 3.
    Foster, J.S., Terauchi, T., Aiken, A.: Flow-Sensitive Type Qualifiers. In: PLDI, Berlin, Germany, June 2002, pp. 1–12 (2002)Google Scholar
  4. 4.
    Gay, S.J., Vasconcelos, V.T., Ravara, A.: Session types for inter-process communication. TR 2003–133, Department of Computing Science, University of Glasgow (March 2003)Google Scholar
  5. 5.
    Gay, S.J., Hole, M.J.: Types and subtypes for client-server interactions. In: Swierstra, S.D. (ed.) ESOP 1999 and ETAPS 1999. LNCS, vol. 1576, pp. 74–90. Springer, Heidelberg (1999)CrossRefGoogle Scholar
  6. 6.
    Gordon, A., Jeffrey, A.: Typing correspondence assertions for communication protocols. Theoretical Computer Science 300, 379–409 (2003)MathSciNetCrossRefMATHGoogle Scholar
  7. 7.
    Grossman, D.: Type-safe multithreading in cyclone. In: ACM Workshop on Types in Language Design and Implementation. ACM Press, New York (2003)Google Scholar
  8. 8.
    Grossman, D., Morrisett, G., Jim, T., Hicks, M., Wang, Y., Cheney, J.: Region-based memory management in cyclone. In: PLDI, pp. 282–293. ACM Press, New York (2002)Google Scholar
  9. 9.
    Honda, K.: Types for dyadic interaction. In: Best, E. (ed.) CONCUR 1993. LNCS, vol. 715, pp. 509–523. Springer, Heidelberg (1993)Google Scholar
  10. 10.
    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
  11. 11.
    Igarashi, A., Kobayashi, N.: Resource usage analysis. In: POPL, pp. 331–342. ACM Press, New York (2002)Google Scholar
  12. 12.
    Igarashi, A., Kobayashi, N.: A generic type system for the π-calculus. Theoretical Computer Science 311(1–3), 121–163 (2003)MathSciNetMATHGoogle Scholar
  13. 13.
    Milner, R., Parrow, J., Walker, D.: A calculus of mobile processes, I and II. Information and Computation 100(1), 1–77 (1992)MathSciNetCrossRefMATHGoogle Scholar
  14. 14.
    Pierce, B.: Types and Programming Languages. The MIT Press, Cambridge (2002)MATHGoogle Scholar
  15. 15.
    Rajamani, S.K., Rehof, J.: A behavioral module system for the π-calculus. In: Cousot, P. (ed.) SAS 2001. LNCS, vol. 2126, pp. 375–394. Springer, Heidelberg (2001)CrossRefGoogle Scholar
  16. 16.
    Reppy, J.: CML: a higher order concurrent language. In: PLDI, pp. 293–305. ACM Press, New York (1991)Google Scholar
  17. 17.
    Sangiorgi, D., Walker, D.: The π-calculus: a Theory of Mobile Processes. Cambridge University Press, Cambridge (2001)MATHGoogle Scholar
  18. 18.
    Takeuchi, K., Honda, K., Kubo, M.: An interaction-based language and its typing system. In: Halatsis, C., Philokyprou, G., Maritsas, D., Theodoridis, S. (eds.) PARLE 1994. LNCS, vol. 817. Springer, Heidelberg (1994)Google Scholar
  19. 19.
    Vallecillo, A., Vasconcelos, V.T., Ravara, A.: Typing the behavior of objects and components using session types. In: FOCLASA 2002, August 2002. Electronic Notes in Theoretical Computer Science, vol. 68. Elsevier, Amsterdam (2002)Google Scholar
  20. 20.
    Walker, D., Crary, K., Morrisett, G.: Typed memory management via static capabilities. TOPLAS 22(4), 701–771 (2000)CrossRefGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2004

Authors and Affiliations

  • Vasco Vasconcelos
    • 1
  • António Ravara
    • 2
  • Simon Gay
    • 3
  1. 1.Departamento de Informática, Faculdade de CiênciasUniversidade de LisboaLisboaPortugal
  2. 2.Departamento de MatemáticaInstituto Superior TécnicoLisboaPortugal
  3. 3.Department of Computing ScienceUniversity of GlasgowGlasgowUK

Personalised recommendations