arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 1606.01400cs.PL
收藏

C/C ++并发的操作方面

Operational Aspects of C/C++ Concurrency

Anton Podkopaev, Ilya Sergey, Aleksandar Nanevski

摘要:

在这项工作中,我们提出了一个家庭的操作语义,逐渐接近现实的程序行为的C/C++11内存模型。我们框架中的每个语义都是通过阐述和组合两个简单的成分构建的:视图和操作缓冲区。视图允许我们表达线程交互的空间方面,即,线程可以读取哪些值,而操作缓冲器使得能够利用时间执行方面进行操纵,即,确定某些操作的结果可以被并发运行的线程观察到的顺序。从一个简单的抽象状态机开始,通过一系列的抽象状态的逐步细化,我们捕获这样的语言方面和同步原语的释放/获取原子,顺序一致和非原子内存访问,还提供了一个语义放松原子,同时避免了稀薄空气的问题。据我们所知,这是C11的第一个正式的和可执行的操作语义,能够表达标准的所有基本并发方面。我们说明了我们的方法,通过一些特征的例子,有关观察到的行为,从文献中的标准石蕊测试程序。我们提供了一个可执行的PLT Redex中的语义实现,以及一些实现的石蕊测试和示例,并展示了我们的原型上的一个大型案例研究:随机测试和调试一个现实的读取-复制-更新数据结构。

英文摘要:

In this work, we present a family of operational semantics that gradually approximates the realistic program behaviors in the C/C++11 memory model. Each semantics in our framework is built by elaborating and combining two simple ingredients: viewfronts and operation buffers. Viewfronts allow us to express the spatial aspect of thread interaction, i.e., which values a thread can read, while operation buffers enable manipulation with the temporal execution aspect, i.e., determining the order in which the results of certain operations can be observed by concurrently running threads. Starting from a simple abstract state machine, through a series of gradual refinements of the abstract state, we capture such language aspects and synchronization primitives as release/acquire atomics, sequentially-consistent and non-atomic memory accesses, also providing a semantics for relaxed atomics, while avoiding the Out-of-Thin-Air problem. To the best of our knowledge, this is the first formal and executable operational semantics of C11 capable of expressing all essential concurrent aspects of the standard. We illustrate our approach via a number of characteristic examples, relating the observed behaviors to those of standard litmus test programs from the literature. We provide an executable implementation of the semantics in PLT Redex, along with a number of implemented litmus tests and examples, and showcase our prototype on a large case study: randomized testing and debugging of a realistic Read-Copy-Update data structure.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑