Reclaiming memory for lock-free data structures: there has to be a better way

12/04/2017
by   Trevor Brown, et al.
0

Memory reclamation for lock-based data structures is typically easy. However, it is a significant challenge for lock-free data structures. Automatic techniques such as garbage collection are inefficient or use locks, and non-automatic techniques either have high overhead, or do not work for many data structures. For example, subtle problems can arise when hazard pointers, one of the most common non-automatic techniques, are applied to many lock-free data structures. Epoch based reclamation (EBR), which is by far the most efficient non-automatic technique, allows the number of unreclaimed objects to grow without bound, because one crashed process can prevent all other processes from reclaiming memory. We develop a more efficient, distributed variant of EBR that solves this problem. It is based on signaling, which is provided by many operating systems, such as Linux and UNIX. Our new scheme takes O(1) amortized steps per high-level operation on the data structure and O(1) steps in the worst case each time an object is removed from the data structure. At any point, O(mn^2) objects are waiting to be freed, where n is the number of processes and m is a small constant for most data structures. Experiments show that our scheme has very low overhead: on average 10%, and at worst 28%, for a balanced binary search tree over many thread counts, operation mixes and contention levels. Our scheme also outperforms a highly tuned implementation of hazard pointers by an average of 75%. Typically, memory reclamation is tightly woven into lock-free data structure code. To improve modularity and facilitate the comparison of different memory reclamation schemes, we also introduce a highly flexible abstraction. It allows a programmer to easily interchange schemes for reclamation, object pooling, allocation and deallocation with virtually no overhead, by changing a single line of code.

READ FULL TEXT

page 1

page 2

page 3

page 4

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
10/10/2018

Using ACL2 in the Design of Efficient, Verifiable Data Structures for High-Assurance Systems

Verification of algorithms and data structures utilized in modern autono...
research
02/25/2023

Efficient Hardware Primitives for Immediate Memory Reclamation in Optimistic Data Structures

Safe memory reclamation (SMR) algorithms are crucial for preventing use-...
research
02/02/2019

Fine-Grain Checkpointing with In-Cache-Line Logging

Non-Volatile Memory offers the possibility of implementing high-performa...
research
03/01/1998

Cached Sufficient Statistics for Efficient Machine Learning with Large Datasets

This paper introduces new algorithms and data structures for quick count...
research
11/10/2022

A rate-compatible solution to the set reconciliation problem

We consider a set reconciliation setting in which two parties hold simil...
research
05/20/2019

Hyaline: Fast and Transparent Lock-Free Memory Reclamation

We present a new lock-free safe memory reclamation algorithm, Hyaline, w...

Please sign up or login with your details

Forgot password? Click here to reset