arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2112.12693cs.PLcs.SE
收藏

Rust中具有多方会话类型的无死锁异步消息重排序

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

Zak Cutner, Nobuko Yoshida, Martin Vassor

摘要:

Rust是一种注重性能和可靠性的现代系统语言。为了补充Rust提供“无畏并发”的承诺,开发人员经常利用异步消息传递。不幸的是,任意地对发送和接收消息进行排序以最大化计算-通信重叠(对消息传递应用程序的流行优化),这打开了一个潘多拉盒子,里面有更多微妙的并发性错误。为了通过构造来保证无死锁,我们提出了Rumpsteak:一个基于多方会话类型的新Rust框架。Rust中以前的会话类型实现要么建立在同步和阻塞通信的基础上,要么局限于两方交互。至关重要的是,它们都不支持为提高效率而对消息进行任意排序。相反,Rumpsteak的目标是异步的JavaScript/await代码。它的独特功能是允许开发人员任意排序发送/接收消息,同时保持无死锁。为此,Rumpsteak结合了两个最近的高级会话类型论:(1)k-多方兼容性(kmc),它全局验证一组参与者的安全性,以及(2)异步多方会话子类型,它在单个参与者的上下文中局部验证优化。具体来说,我们提出了一种新的算法,异步子类型,是健全的和可判定的。我们首先评估Rumpsteak与之前三个Rust实现的性能和表现力。我们发现Rumpsteak的效率提高了1.7- 8.6倍,并且可以通过提供任意的消息排序来安全地表达更多的示例。其次,我们分析了我们的新算法的复杂性,并将其与kmc和二进制会话子类型算法进行了比较。我们发现它们比Rumpsteak的要慢得多。

英文摘要:

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.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑