未来与状态的响应式企业主义
Responsive Parallelism with Futures and State
摘要:
受多核计算机的日益发展的推动,最近的工作已经开发出了对响应并行应用程序的语言支持,这些应用程序将计算密集型任务与延迟敏感的,通常是交互式的任务混合在一起。这些发展包括允许为线程分配优先级的演算,可以排除优先级反转的类型系统,以及用于预测响应性的附带成本模型。这些进步都有一个重要的局限性:所有这些工作都假设纯函数式编程。这是一个重要的限制,因为许多现实的交互式应用程序,从游戏到机器人到Web服务器,都使用可变状态,例如,用于线程之间的通信。在本文中,我们解除了关于使用状态的限制。我们提出了$λ_i^4$,一个演算与隐式并行的形式优先期货和可变状态的形式引用。因为future和reference都是一级值,所以$λ_i^4$程序可以表现出复杂的依赖关系,包括线程之间的交互以及与外部世界(用户、网络等)的交互。要原因的响应$λ_i^4$程序,我们扩展了传统的基于图形的并行成本模型,以考虑到通过可变状态创建的依赖关系,我们提出了一个类型系统,以取缔优先级反转,可以导致无限阻塞。我们表明,这些技术是实用的,通过在C++中实现它们,并提出了实证评估。
英文摘要:
Motivated by the increasing shift to multicore computers, recent work has developed language support for responsive parallel applications that mix compute-intensive tasks with latency-sensitive, usually interactive, tasks. These developments include calculi that allow assigning priorities to threads, type systems that can rule out priority inversions, and accompanying cost models for predicting responsiveness. These advances share one important limitation: all of this work assumes purely functional programming. This is a significant restriction, because many realistic interactive applications, from games to robots to web servers, use mutable state, e.g., for communication between threads. In this paper, we lift the restriction concerning the use of state. We present $λ_i^4$, a calculus with implicit parallelism in the form of prioritized futures and mutable state in the form of references. Because both futures and references are first-class values, $λ_i^4$ programs can exhibit complex dependencies, including interaction between threads and with the external world (users, network, etc). To reason about the responsiveness of $λ_i^4$ programs, we extend traditional graph-based cost models for parallelism to account for dependencies created via mutable state, and we present a type system to outlaw priority inversions that can lead to unbounded blocking. We show that these techniques are practical by implementing them in C++ and present an empirical evaluation.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。