To save content items to your account,
please confirm that you agree to abide by our usage policies.
If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your account.
Find out more about saving content to .
To save content items to your Kindle, first ensure no-reply@cambridge.org
is added to your Approved Personal Document E-mail List under your Personal Document Settings
on the Manage Your Content and Devices page of your Amazon account. Then enter the ‘name’ part
of your Kindle email address below.
Find out more about saving to your Kindle.
Note you can select to save to either the @free.kindle.com or @kindle.com variations.
‘@free.kindle.com’ emails are free but can only be saved to your device when it is connected to wi-fi.
‘@kindle.com’ emails can be delivered even when you are not connected to wi-fi, but note that service fees apply.
This chapter introduces a variant of the pi calculus defined in Chapter 2. We drop choice and channel closing, retaining only message passing. To compensate, messages may now carry values other than channel endpoints: we introduce record and variant values, both of which are standard in functional languages. We further introduce new processes to eliminate the new values. We play the same game at the type level: from input/output, external/internal choice and the two end types, we retain only input/output types. In return we incorporate record and variant types, again standard from functional languages. Unlike the input and output types in all preceding chapters, those in this chapter have no continuation. These changes lead to a linear pi calculus with record and variant types. The interesting characteristic of this calculus is that it allows us to faithfully encode the pi calculus with session types, even though it has no specific support for session types. We present an encoding based on work by Dardha, Giachino and Sangiorgi.
The previous chapters present a linear world in which each channel endpoint is possessed by exactly one thread. Linearity allows precise control of interference and that can be useful. If two processes engage in a series of consecutive message exchanges then we can be sure that messages are not sent to or received from foreign processes. Although linearity is often convenient, it can also be detrimental in concurrent systems. Purely linear systems cannot describe e-commerce interactions where a server (or a pool of servers) is expected to serve a much larger number of clients. Linear systems also fail to describe an auction, where at the end, only one bidder is to get the item for sale. This chapter introduces a type discipline that provides for channels that can be shared and consequently for processes that compete for resources, thus creating race conditions and nondeterminism. We do this in such a way that we do not need to revisit process formation or process reduction, and process typing only requires mild changes. We define the language and type system as extensions of those in Chapter 3.
Up to now, we have presented session type systems for the pi calculus. If session types are to be used for practical software development, they need to be applied to standard programming language paradigms rather than a foundational calculus. This chapter takes a step in that direction by defining a session type system for a concurrent lambda calculus, which can be regarded as a core concurrent programming language. After presenting some examples, we introduce a syntax for functional programs with concurrency and channel-based communication. We include infinite types from the beginning (based on Chapter 3) and include sharing (Chapter 4) and subtyping (Chapter 5). We then introduce a type system for the functional language, develop its operational semantics and prove type safety.
This chapter presents the basic concepts of session types, using the pi calculus as a core concurrent programming language for which a type system is defined. It assumes some familiarity with the pi calculus and the concepts of operational semantics and type systems. References to background reading are included at the end of the chapter.
Many type systems include the concept of subtyping, allowing a value of one type (the subtype) to be used as if it is a value of another type (the supertype). The aim is to allow greater flexibility in programming, while maintaining safety. In this chapter, we see how subtyping can be included in our system of session types. We build on the language in Chapter 4, using replicated input, rather than recursive process definitions, to express repetitive behaviour.
This chapter describes the evolution of computing systems, from data processing to an emphasis on communication, and motivates a corresponding evolution of the concept of typing. Data types codify the structure of data, and go back to the early days of programming languages. This book is about session types, which codify the structure of communication – they are type-theoretic specifications of communication protocols. The chapter summarises the assumptions about communication that are necessary for the theory of session types, and describes the behavioural safety properties that are guaranteed by checking session types.
The earlier chapters present session type systems declaratively, focusing on how typing judgements describe the way in which processes use channels. In order to apply session types to programming languages, it is essential to be able to implement an efficient typechecking algorithm which answers the question: given a candidate typing judgement, is it derivable? The declarative typing rules, however, are not immediately suitable for implementation. In this chapter we explain the problem and how to overcome it.
This chapter develops a theory of infinite session types in order to describe communication protocols that allow unbounded behaviour. The theory is based on the technical machinery of recursive types, coalgebras and coinduction, which the chapter introduces at an elementary level. Recursive process definitions are introduced so that unbounded behaviour can be implemented. The type safety results of Chapter 2 are extended to the new setting.
Communication in the languages presented so far is synchronous: a sending action blocks the sender until it can interact with a compatible receiving action at the intended receiver. In this chapter, we consider an alternative semantics for interactions: asynchronous communication. Asynchronous communication allows for a sending action to be executed without waiting for the receiver to be ready by storing the sent message in a message queue that the intended receiver can later read.
We introduce our first choreography language, Simple Choreographies, which allows for writing sequences of interactions between processes. The key aspect of the language is that interactions are syntactically manifest in choreographies. A semantics of choreographies is obtained in terms of a labelled transition system.
Before venturing into the study of choreographies, we introduce the formalism of inference systems. Inference systems are widely used in the fields of formal logic and programming languages and they were later applied to theory of choreographies as well.