Adaptive Lock-Free Data Structures in Haskell: A General Method for Concurrent Implementation Swapping

08/07/2017
by   Chao-Hong Chen, et al.
0

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.

READ FULL TEXT

page 1

page 2

page 3

page 4

research
08/17/2022

Performance Anomalies in Concurrent Data Structure Microbenchmarks

Recent decades have witnessed a surge in the development of concurrent d...
research
08/20/2018

Every Data Structure Deserves Lock-Free Memory Reclamation

Memory-management support for lock-free data structures is well known to...
research
06/17/2019

Monotonically relaxing concurrent data-structure semantics for performance: An efficient 2D design framework

There has been a significant amount of work in the literature proposing ...
research
10/20/2017

Parallel Combining: Making Use of Free Cycles

There are two intertwined factors that affect performance of concurrent ...
research
08/15/2019

"LOADS of Space": Local Order Agnosticism and Bit Flip Efficient Data Structure Codes

Algorithms, data structures, coding techniques, and other methods that r...
research
04/13/2017

Two variants of the Froiduire-Pin Algorithm for finite semigroups

In this paper, we present two algorithms based on the Froidure-Pin Algor...
research
12/31/2021

Elimination (a,b)-trees with fast, durable updates

Many concurrent dictionary implementations are designed and optimized fo...

Please sign up or login with your details

Forgot password? Click here to reset