-
A more Pragmatic Implementation of the Lock-free, Ordered, Linked List
Authors:
Jesper Larsson Träff,
Manuel Pöter
Abstract:
The lock-free, ordered, linked list is an important, standard example of a concurrent data structure. An obvious, practical drawback of textbook implementations is that failed compare-and-swap (CAS) operations lead to retraversal of the entire list (retries), which is particularly harmful for such a linear-time data structure. We alleviate this drawback by first observing that failed CAS operation…
▽ More
The lock-free, ordered, linked list is an important, standard example of a concurrent data structure. An obvious, practical drawback of textbook implementations is that failed compare-and-swap (CAS) operations lead to retraversal of the entire list (retries), which is particularly harmful for such a linear-time data structure. We alleviate this drawback by first observing that failed CAS operations under some conditions do not require a full retry, and second by maintaining approximate backwards pointers that are used to find a closer starting position in the list for operation retry. Experiments with both a worst-case deterministic benchmark, and a standard, randomized, mixed-operation throughput benchmark on three shared-memory systems (Intel Xeon, AMD EPYC, SPARC-T5) show practical improvements ranging from significant, to dramatic, several orders of magnitude.
△ Less
Submitted 30 October, 2020; v1 submitted 29 October, 2020;
originally announced October 2020.
-
Stamp-it: A more Thread-efficient, Concurrent Memory Reclamation Scheme in the C++ Memory Model
Authors:
Manuel Pöter,
Jesper Larsson Träff
Abstract:
We present Stamp-it, a new, concurrent, lock-less memory reclamation scheme with amortized, constant-time (thread-count independent) reclamation overhead. Stamp-it has been implemented and proved correct in the C++ memory model using as weak memory-consistency assumptions as possible. We have likewise (re)implemented six other comparable reclamation schemes. We give a detailed performance comparis…
▽ More
We present Stamp-it, a new, concurrent, lock-less memory reclamation scheme with amortized, constant-time (thread-count independent) reclamation overhead. Stamp-it has been implemented and proved correct in the C++ memory model using as weak memory-consistency assumptions as possible. We have likewise (re)implemented six other comparable reclamation schemes. We give a detailed performance comparison, showing that Stamp-it performs favorably (sometimes better, at least as good as) than most of these other schemes while being able to reclaim free memory nodes earlier.
△ Less
Submitted 19 October, 2018; v1 submitted 21 May, 2018;
originally announced May 2018.
-
Memory Models for C/C++ Programmers
Authors:
Manuel Pöter,
Jesper Larsson Träff
Abstract:
The memory model is the crux of the concurrency semantics of shared-memory systems. It defines the possible values that a read operation is allowed to return for any given set of write operations performed by a concurrent program, thereby defining the basic semantics of shared variables. It is therefore impossible to meaningfully reason about a program or any part of the programming language imple…
▽ More
The memory model is the crux of the concurrency semantics of shared-memory systems. It defines the possible values that a read operation is allowed to return for any given set of write operations performed by a concurrent program, thereby defining the basic semantics of shared variables. It is therefore impossible to meaningfully reason about a program or any part of the programming language implementation without an unambiguous memory model.
This note provides a brief introduction into the topic of memory models, explaining why it is essential for concurrent programs and covering well known memory models from sequential consistency to those of the x86 and ARM/POWER CPUs. Section 4 is fully dedicated to the C++11 memory model, explaining how it can be used to write concurrent code that is not only correct and portable, but also efficient by utilizing the relaxed memory models of modern architectures.
△ Less
Submitted 12 March, 2018;
originally announced March 2018.
-
A new and five older Concurrent Memory Reclamation Schemes in Comparison (Stamp-it)
Authors:
Manuel Pöter,
Jesper Larsson Träff
Abstract:
Memory management is a critical component in almost all shared-memory, concurrent data structures and algorithms, consisting in the efficient allocation and the subsequent reclamation of shared memory resources. This paper contributes a new, lock-free, amortized constant-time memory reclamation scheme called \emph{Stamp-it}, and compares it to five well-known, selectively efficient schemes from th…
▽ More
Memory management is a critical component in almost all shared-memory, concurrent data structures and algorithms, consisting in the efficient allocation and the subsequent reclamation of shared memory resources. This paper contributes a new, lock-free, amortized constant-time memory reclamation scheme called \emph{Stamp-it}, and compares it to five well-known, selectively efficient schemes from the literature, namely Lock-free Reference Counting, Hazard Pointers, Quiescent State-based Reclamation, Epoch-based Reclamation, and New Epoch-based Reclamation. An extensive, experimental evaluation with both new and commonly used benchmarks is provided, on four different shared-memory systems with hardware supported thread counts ranging from 48 to 512, showing Stamp-it to be competitive with and in many cases and aspects outperforming other schemes.
△ Less
Submitted 17 December, 2017;
originally announced December 2017.
-
Pheet meets C++11
Authors:
Manuel Pöter
Abstract:
Pheet is a C++ task-scheduling framework that allows for easy customization of internal data-structures. The implementation was started before the C++11 standard was committed and therefore did not use the new standardized memory model but compiler/platform specific intrinsics for atomic memory operations. This not only makes the implementation harder to port to other compilers or architectures bu…
▽ More
Pheet is a C++ task-scheduling framework that allows for easy customization of internal data-structures. The implementation was started before the C++11 standard was committed and therefore did not use the new standardized memory model but compiler/platform specific intrinsics for atomic memory operations. This not only makes the implementation harder to port to other compilers or architectures but also suffers from the fact that prior C++ versions did not specify any memory model.
In this report I discuss the porting of one of the internal Pheet data structures to the new memory model and provide reasoning about the correctness based on the semantics of the memory consistency model. Using two benchmarks from the Pheet benchmark suite I compare the performance of the original against the new implementation which shows a significant speedup under certain conditions on one of the two test machines.
△ Less
Submitted 7 November, 2014;
originally announced November 2014.