Deadlock-free asynchronous message reordering in Rust with multiparty session types

12/23/2021
by   Zak Cutner, et al.
0

Rust is a modern systems language focused on performance and reliability. Complementing Rust's promise to provide "fearless concurrency", developers frequently exploit asynchronous message passing. Unfortunately, arbitrarily ordering sending and receiving messages to maximise computation-communication overlap (a popular optimisation to message-passing applications) opens up a Pandora's box of further subtle concurrency bugs. To guarantee deadlock-freedom by construction, we present Rumpsteak: a new Rust framework based on multiparty session types. Previous session type implementations in Rust are either built upon synchronous and blocking communication and/or limited to two-party interactions. Crucially, none support the arbitrary ordering of messages for efficiency. Rumpsteak instead targets asynchronous async/await code. Its unique ability is allowing developers to arbitrarily order send/receive messages while preserving deadlock-freedom. For this, Rumpsteak incorporates two recent advanced session type theories: (1) k-multiparty compatibility (kmc), which globally verifies the safety of a set of participants, and (2) asynchronous multiparty session subtyping, which locally verifies optimisations in the context of a single participant. Specifically, we propose a novel algorithm for asynchronous subtyping that is both sound and decidable. We first evaluate the performance and expressiveness of Rumpsteak against three previous Rust implementations. We discover that Rumpsteak is around 1.7–8.6x more efficient and can safely express many more examples by virtue of offering arbitrary message ordering. Secondly, we analyse the complexity of our new algorithm and benchmark it against kmc and a binary session subtyping algorithm. We find they are exponentially slower than Rumpsteak's.

READ FULL TEXT

page 1

page 2

page 3

page 4

research
10/05/2018

On Urgency in Asynchronous Timed Session Types

We study an urgent semantics of asynchronous timed session types, where ...
research
04/02/2019

A Message-Passing Interpretation of Adjoint Logic

We present a system of session types based on adjoint logic which genera...
research
01/20/2021

Fair Refinement for Asynchronous Session Types (extended version)

Session types are widely used as abstractions of asynchronous message pa...
research
02/22/2023

Asynchronous Multiparty Session Type Implementability is Decidable – Lessons Learned from Message Sequence Charts

Multiparty session types (MSTs) provide efficient means to specify and v...
research
10/26/2020

Precise Subtyping for Asynchronous Multiparty Sessions

This paper presents the first formalisation of the precise subtyping rel...
research
08/09/2022

On Composing Communicating Systems

Communication is an essential element of modern software, yet programmin...
research
01/28/2019

Verifying Asynchronous Interactions via Communicating Session Automata

The relationship between communicating automata and session types is the...

Please sign up or login with your details

Forgot password? Click here to reset