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——该经典教科书协议用于在不可靠异步网络中达成共识——证明了所提框架的表达能力。