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.
翻译:在编程中,规程无处不在。 规程描述了软件系统之间互动( 或交流) 的模式, 例如用户空间程序与内核之间, 或本地应用程序与在线服务之间的互动( 或交流) 。 确保规程符合规程避免大量软件错误 。 随后, 在对照正式规程规格核查代码方面做了大量工作 。 渗透的方法侧重于单一单一单一单一规程描述中的程序平行构成的分布式设置 。 然而, 我们观察到, 在单一线程/ 程序层面, 现代软件必须经常同时执行一系列清晰的规程, 彼此依附于对方, 例如, 银行 API 和一个或多个认证协议; 确保规程的一致性, 而不是将多个协议合并成一个单一的规程 。 我们的规程, 将一个新的规程编成一个新的规程, 将一个新的规程的规程 。