Abstract

This paper presents a framework for the static specification and safe programming of message passing protocols where the number and kinds of participants are dynamically instantiated. We develop the first theory of distributed multiparty session types (MPST) to support parameterised protocols with indexed roles—our framework statically infers the different kinds of participants induced by a protocol definition as role variants, and produces decoupled endpoint projections of the protocol onto each variant. This enables safe MPST-based programming of the parameterised endpoints in distributed settings: each endpoint can be implemented separately by different programmers, using different techniques (or languages). We prove the decidability of role variant inference and well-formedness checking, and the correctness of projection. We implement our theory as a toolchain for programming such role-parametric MPST protocols in Go. Our approach is to generate API families of lightweight, protocol- and variant-specific type wrappers for I/O. The APIs ensure a well-typed Go endpoint program (by native Go type checking) will perform only compliant I/O actions w.r.t. the source protocol. We leverage the abstractions of MPST to support the specification and implementation of Go applications involving multiple channels, possibly over mixed transports (e.g., Go channels, TCP), and channel passing via a unified programming interface. We evaluate the applicability and run-time performance of our generated APIs using microbenchmarks and real-world applications.

Highlights

  • 1.1 Channel-Based Concurrent and Distributed Programming in Go Go is a popular industrial systems language.1 One of its primary design features is first-class language support for lightweight concurrency on multicore machines

  • Goroutines communicate and synchronize via message passing over typed channels, designed to alleviate the difficulties of low-level mechanisms such as mutexes, condition variables and memory barriers commonly used in systems programming

  • In this paper, we present a new, practical framework for the static specification and safe implementation of distributed Go programs, centred around a pivotal extension of the theory of multiparty session types (MPST) [Coppo et al 2016; Honda et al 2016]

Read more

Summary

Introduction

1.1 Channel-Based Concurrent and Distributed Programming in Go Go is a popular industrial systems language. One of its primary design features is first-class language support for lightweight concurrency on multicore machines. 1.1 Channel-Based Concurrent and Distributed Programming in Go Go is a popular industrial systems language.. One of its primary design features is first-class language support for lightweight concurrency on multicore machines. Goroutines communicate and synchronize via message passing over typed channels, designed to alleviate the difficulties of low-level mechanisms such as mutexes, condition variables and memory barriers commonly used in systems programming. As first-class objects, an interesting and useful feature is the ability to pass channels over channels. Go is well-established in distributed systems; e.g., it is the implementation language of frameworks such as Kubernetes, Docker and Jaeger. As the aforementioned concurrency features of Go are specific to shared memory, a significant class of distributed programming in Go is conducted using channel-based networking libraries via TCP, HTTP, etc. Developers appreciate Go since distributed programming in practice often involves local concurrency: goroutines and channels are effective for dealing locally with the inherent asynchrony of distributed interactions

Objectives
Methods
Results
Full Text
Published version (Free)

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call