Good projections improve safety and flexibility of distributed programs

What is a Good Projection?: Correctness and Separation Results of End-Point Projections

Programming LanguagesLogic in Computer Science

Summary

Distributed programs involve multiple participants working together, but making sure they do so correctly and without getting stuck is hard. The authors study a method called multiparty session types that breaks down a global plan into smaller parts for each participant. They identify general rules for these breakdowns, called good projections, that guarantee the program runs safely and smoothly. They analyze various existing methods, find which ones work and which don't, and offer new ones that handle harder cases. This helps programmers pick the best approach for their needs and ensures their systems behave correctly.

What this means in practice

  • For distributed software engineers: Choose correct projection methods to ensure deadlock-free and live distributed applications when implementing communication protocols.
  • For protocol designers: Evaluate trade-offs between complexity and expressiveness when specifying communication in multiparty systems based on projection criteria.

A theory result. No direct application yet.

Authors

Jake Masters, Nobuko Yoshida

Abstract

\emph{Multiparty session types} (MPST) is a type discipline for ensuring distributed programs are implemented correctly \emph{by construction}. MPST starts by specifying a choreographic protocol as a \emph{global type} and \emph{projects} it onto each participant, generating \emph{local types} with a guarantee of type soundness and deadlock-freedom. A central issue of MPST is that its type soundness is fragile, as it must be proven each time with respect to a chosen projection algorithm under specific semantics with a specific program correctness goal. To overcome this problem, we propose general criteria for a \emph{good projection} -- a set of requirements for projection algorithms by which type soundness, deadlock-freedom and liveness of distributed programs are \emph{automatically} derived. Using the criteria, we prove that 8 distinct projections in the literature are good under both synchronous and asynchronous semantics, and that 4 are incorrect, failing type soundness. We extend the good projection criteria to mixed choice global types and asynchronous communication optimisations, proposing new ``good projection'' algorithms. We apply properties of good projections to prove \emph{separation} and \emph{expressiveness} results over the projection algorithms and MPST typing systems. Having a generalised typing system that is robust with respect to the good projection criteria, we provide an implementation with mixed choice global types that is \emph{modular} with respect to a chosen projection algorithm and desired program properties. Our separation results help programmers make informed trade-offs between complexity and expressiveness when choosing projection algorithms, and our theory ensures their chosen algorithms are correctly applied.