We tackle the problem of automatically designing concurrent data structure operations given a sequential data structure specification and knowledge about concurrent behavior. Designing concurrent code is a non-trivial task even in simplest of cases. Humans often design concurrent data structure operations by transforming sequential versions into their respective concurrent versions. This requires an understanding of the data structure, its sequential behavior, thread interactions during concurrent execution and shared memory synchronization primitives. We mechanize this design process using automated commonsense reasoning. We assume that the data structure description is provided as axioms alongside the sequential code of its algebraic operations. This information is used to automatically derive concurrent code for that data structure, such as dictionary operations for linked lists and binary search trees. Knowledge in our case is expressed using Answer Set Programming (ASP), and we employ deduction and abduction -- just as humans do -- in the reasoning involved. ASP allows for succinct modeling of first order theories of pointer data structures, run-time thread interactions and shared memory synchronization. Our reasoner can systematically make the same judgments as a human reasoner, while constructing provably safe concurrent code. We present several reasoning challenges involved in transforming the sequential data structure into its equivalent concurrent version. All the reasoning tasks are encoded in ASP and our reasoner can make sound judgments to transform sequential code into concurrent code. To the best of our knowledge, our work is the first one to use commonsense reasoning to automatically transform sequential programs into concurrent code. We also have developed a tool that we describe that relies on state-of-the-art ASP solvers and performs the reasoning tasks involved to generate concurrent code.
翻译:我们处理的是自动设计并行数据结构操作的问题,因为有顺序的数据结构规格和关于并行行为的知识。设计并行代码是一项非三重任务,即使是在最简单的案例中也是如此。人类往往通过将相继版本转换为各自的同时版本来设计并行的数据结构操作。这需要理解数据结构、其相继行为、同时执行和共享记忆同步原始过程中的线条互动。我们用自动公元共识推理将这一设计过程机械化。我们假设数据结构描述是与其代数操作的顺序代码相平行提供的。这种信息被用来自动为数据结构生成并行代码,例如链接列表的字典操作和双元搜索树等。我们的案件知识是用“答案设置”程序(ASP)来表达的,我们在推理中也像人类一样使用推理法一样的推理和绑架。ASP可以简明地建模该工具数据结构的第一顺序理论、运行时的线条互动和共享的记忆同步。我们的解释者可以系统地将同一推理法推理作为人类的比喻,同时构建安全的代码。我们用一些推理推理来解释我们连续结构结构结构结构结构的推理的推理工作。