论文标题
组成协议的理论
A Theory of Composing Protocols
论文作者
论文摘要
在编程中,协议无处不在。协议描述了软件系统之间的交互模式(或通信),例如在用户空间程序和内核之间或本地应用程序和在线服务之间。确保符合协议可以避免重大的软件错误。随后,针对正式协议规范进行验证代码有很多工作。泛滥的方法集中在单个整体协议描述中涉及过程平行组成的分布式设置上。但是,我们观察到,在单个线程/过程的层面上,现代软件通常必须同时实现许多清晰划定的协议,这些协议彼此依赖,例如银行API和一个或多个身份验证协议。代码不必插入模块化协议遵循组件,而是将多个协议重新整合到单个组件中。 我们通过对通过过程代数描述的方案的“交织”组成的新颖概念结合方案的问题。可以将用户指定的特定于域特定的约束插入单个协议中,以作为“联系点”来指导此组成过程,该过程输出了一个可以对其进行编程的单个组合协议。我们的方法使工程师可以针对已组成(重新集成)的许多协议进行编程,从而反映了必须一次处理多个协议的应用程序的真实性质。 我们证明了组成的各种理想特性,包括行为保存:组成的协议实现了两个组件协议的行为。我们在Erlang的实际环境中演示了我们的方法,该工具实现了协议组成,该工具都从协议中生成Erlang代码并从Erlang代码生成协议。该工具显示,对于一系列示例协议(包括现实世界示例),可以插入一组适度的约束,以产生少量的候选构图供您选择。 随着我们越来越多地构建与许多程序和子系统交互的软件,这种新的观点为通过在多协议设置中的协议符合来提高软件质量的基础为基础提供了基础。
In programming, protocols are everywhere. Protocols describe the pattern of interaction (or communication) between software systems, for example, between a user-space program and the kernel or between a local application and an online service. Ensuring conformance to protocols avoids a significant class of software errors. Subsequently, there has been a lot of work on verifying code against formal protocol specifications. The pervading approaches focus on distributed settings involving parallel composition of processes within a single monolithic protocol description. However we observe that, at the level of a single thread/process, modern software must often implement a number of clearly delineated protocols at the same time which become dependent on each other, e.g., a banking API and one or more authentication protocols. Rather than plugging together modular protocol-following components, the code must re-integrate multiple protocols into a single component. We address this concern of combining protocols via a novel notion of 'interleaving' composition for protocols described via a process algebra. User-specified, domain-specific constraints can be inserted into the individual protocols to serve as 'contact points' to guide this composition procedure, which outputs a single combined protocol that can be programmed against. Our approach allows an engineer to then program against a number of protocols that have been composed (re-integrated), reflecting the true nature of applications that must handle multiple protocols at once. We prove various desirable properties of the composition, including behaviour preservation: that the composed protocol implements the behaviour of both component protocols. We demonstrate our approach in the practical setting of Erlang, with a tool implementing protocol composition that both generates Erlang code from a protocol and generates a protocol from Erlang code. This tool shows that, for a range of sample protocols (including real-world examples), a modest set of constraints can be inserted to produce a small number of candidate compositions to choose from. As we increasingly build software interacting with many programs and subsystems, this new perspective gives a foundation for improving software quality via protocol conformance in a multi-protocol setting.