Session types are formal specifications of communication protocols, allowing protocol implementations to be verified by typechecking. Up to now, session type disciplines have assumed that the communication medium is reliable, with no loss of messages. However, unreliable broadcast communication is common in a wide class of distributed systems such as ad-hoc and wireless sensor networks. Often such systems have structured communication patterns that should be amenable to analysis by means of session types, but the necessary theory has not previously been developed. We introduce the Unreliable Broadcast Session Calculus, a process calculus with unreliable broadcast communication, and equip it with a session type system that we show is sound. We capture two common operations, broadcast and gather, inhabiting dual session types. Message loss may lead to non-synchronised session endpoints. To further account for unreliability we provide with an autonomous recovery mechanism that does not require acknowledgements from session participants. Our type system ensures soundness, safety, and progress between the synchronised endpoints within a session. We demonstrate the expressiveness of our framework by implementing Paxos, the textbook protocol for reaching consensus in an unreliable, asynchronous network.
翻译:会话类型是通信协议的形式化规范,通过类型检查可验证协议实现。迄今为止,会话类型学科均假设通信媒介可靠且无消息丢失。然而,在自组网与无线传感器网络等广泛类型的分布式系统中,不可靠广播通信普遍存在。此类系统通常具有适合通过会话类型进行分析的结构化通信模式,但此前尚未建立必要的理论框架。我们提出不可靠广播会话演算这一包含不可靠广播通信的过程演算,并为其配备经证明可靠的会话类型系统。我们捕获了占据对偶会话类型的两种常见操作:广播与收集。消息丢失可能导致会话端点不同步。为进一步应对不可靠性,我们提供了一种无需会话参与者确认的自主恢复机制。我们的类型系统确保会话内同步端点的可靠性、安全性与进展性。通过实现Paxos(在不可靠异步网络中达成共识的经典协议),我们展示了该框架的表达能力。