一句话:提出支持纠缠与任意突变的技术,使并行函数式语言兼顾安全与性能。
并行函数式语言能避免数据竞争,但传统上性能不佳。层次化内存架构允许处理器独立分配和回收内存、无需同步,从而解决关键性能问题,但为保证堆间独立性的“解缠”而限制突变/内存效应。本文提出支持“纠缠”并允许函数式程序任意使用突变的技术:区分解缠与纠缠对象,使解缠对象免受纠缠管理开销,并以内存对象为粒度形式化纠缠,定义成本度量以分析时间和空间开销。作者扩展 Parallel ML 的 MPL 编译器,支持其全部特性(包括无限制效应)。基准测试显示相较顺序执行仅有小的时间和空间开销,扩展性良好,并与 C++、Go、Java、OCaml 等语言竞争。
Although functional programming languages simplify writing safe parallel programs by helping programmers to avoid data races, they have traditionally delivered poor performance. Recent work improved performance by using a hierarchical memory architecture that allows processors to allocate and reclaim memory independently without any synchronization, solving thus the key performance challenge afflicting functional programs. The approach, however, restricts mutation, or memory effects, so as to ensure "disentanglement", a low-level memory property that guarantees independence between different heaps in the hierarchy.This paper proposes techniques for supporting entanglement and for allowing functional programs to use mutation at will. Our techniques manage entanglement by distinguishing between disentangled and entangled objects and shielding disentangled objects from the cost of entanglement management. We present a semantics that formalizes entanglement as a property at the granularity of memory objects, and define several cost metrics to reason about and bound the time and space cost of entanglement. We present an implementation of the techniques by extending the MPL compiler for Parallel ML. The extended compiler supports all features of the Parallel ML language, including unrestricted effects. Our experiments using a variety of benchmarks show that MPL incurs a small time and space overhead compared to sequential runs, scales well, and is competitive with languages such as C++, Go, Java, OCaml. These results show that our techniques can marry the safety benefits of functional programming with performance.
@article{paperbot1941,
title = {Efficient Parallel Functional Programming with Effects},
author = {Jatin Arora and Sam Westrick and Umut A. Acar},
journal = {Proceedings of the ACM on Programming Languages},
volume = {7},
number = {PLDI},
year = {2023},
doi = {10.1145/3591284}
}