一句话:提出行为导向并发 BoC,将行为作为统一原语实现原子有序的事务型并发,支持多资源独占访问。
并行与协调的表达在现代并发编程中密不可分,但现有机制常将二者设计纠缠在一起。Actor 模型通过细粒度状态分解获得并行,却难以把对多个 actor 的更新合并为单个原子操作。本文提出行为导向并发(Behaviour-Oriented Concurrency, BoC):重新审视“行为”这一基本概念,提供更事务化的并发模型,可异步创建原子且有序的工作单元,并独占访问一组相互独立的资源。论文用示例说明多资源独占访问与顺序性的必要性,给出形式化模型,并以 C++ 运行时实现验证其实用性。基于 Savina 基准的评估表明,原本用 Actor 表达的基准可更紧凑地用 BoC 表示,性能相当甚至更优。
Expressing parallelism and coordination is central for modern concurrent programming. Many mechanisms exist for expressing both parallelism and coordination. However, the design decisions for these two mechanisms are tightly intertwined. We believe that the interdependence of these two mechanisms should be recognised and achieved through a single, powerful primitive. We are not the first to realise this: the prime example is actor model programming, where parallelism arises through fine-grained decomposition of a program’s state into actors that are able to execute independently in parallel. However, actor model programming has a serious pain point: updating multiple actors as a single atomic operation is a challenging task. We address this pain point by introducing a new concurrency paradigm: Behaviour-Oriented Concurrency (BoC). In BoC, we are revisiting the fundamental concept of a behaviour to provide a more transactional concurrency model. BoC enables asynchronously creating atomic and ordered units of work with exclusive access to a collection of independent resources. In this paper, we describe BoC informally in terms of examples, which demonstrate the advantages of exclusive access to several independent resources, as well as the need for ordering. We define it through a formal model. We demonstrate its practicality by implementing a C++ runtime. We argue its applicability through the Savina benchmark suite: benchmarks in this suite can be more compactly represented using BoC in place of Actors, and we observe comparable, if not better, performance.
@article{paperbot1845,
title = {When Concurrency Matters: Behaviour-Oriented Concurrency},
author = {Luke Cheeseman and Matthew J. Parkinson and Sylvan Clebsch and Marios Kogias and Sophia Drossopoulou and David Chisnall and Tobias Wrigstad and Paul Liétar},
journal = {Proceedings of the ACM on Programming Languages},
volume = {7},
number = {OOPSLA2},
year = {2023},
doi = {10.1145/3622852}
}