A key part of implementing high-level languages is providing built-in and default data structures. Yet selecting good defaults is hard. A mutable data structure's workload is not known in advance, and it may shift over its lifetime - e.g., between read-heavy and write-heavy, or from heavy contention by multiple threads to single-threaded or low-frequency use. One idea is to switch implementations adaptively, but it is nontrivial to switch the implementation of a concurrent data structure at runtime. Performing the transition requires a concurrent snapshot of data structure contents, which normally demands special engineering in the data structure's design. However, in this paper we identify and formalize an relevant property of lock-free algorithms. Namely, lock-freedom is sufficient to guarantee that freezing memory locations in an arbitrary order will result in a valid snapshot. Several functional languages have data structures that freeze and thaw, transitioning between mutable and immutable, such as Haskell vectors and Clojure transients, but these enable only single-threaded writers. We generalize this approach to augment an arbitrary lock-free data structure with the ability to gradually freeze and optionally transition to a new representation. This augmentation doesn't require changing the algorithm or code for the data structure, only replacing its datatype for mutable references with a freezable variant. In this paper, we present an algorithm for lifting plain to adaptive data and prove that the resulting hybrid data structure is itself lock-free, linearizable, and simulates the original. We also perform an empirical case study in the context of heating up and cooling down concurrent maps.
翻译:执行高层次语言的关键部分是提供内置和默认数据结构。 但选择良好的默认是困难的。 选择良好的默认值需要同时对数据结构的内容进行快速描述, 这通常需要在数据结构的设计中进行特殊的工程设计。 然而, 在本文中, 我们确定并正式了无锁算法的相关属性。 也就是说, 无锁足以保证任意将记忆位置冻结在多行线上, 从而产生有效的快照。 一些功能语言有数据结构, 以适应的方式转换执行, 但要在运行时切换一个同时的数据结构。 在运行时转换一个同时的数据结构。 执行过渡需要同时对数据结构的内容进行快速切换, 这通常需要在数据结构设计中进行特殊的工程设计。 然而, 在本文中, 我们确定并正式了一个无锁的无锁算法属性。 某些功能语言有数据结构可以冻结和移动, 将数据转换为可移动和不可变换的, 如Haskelllibal 和 Clojoral Transtits, 但是, 只能进行单一的直线化的读数据结构 。, 我们将这一方法可以使数据转换为可变式数据结构 逐步地更新数据结构 。