xenium
xenium

xenium is a header-only library that provides a collection of concurrent data structures and memory reclamation algorithms. The data structures are parameterized so that they can be used with various reclamation schemes (similar to how the STL allows customization of allocators).

The documentation provides more details.

This project is based on my previous work in https://github.com/mpoeter/emr

Usage Example

#include <xenium/ramalhete_queue.hpp>
#include <xenium/reclamation/epoch_based.hpp>
struct msg { ... };
std::unique_ptr<msg>,
> queue;
queue.push(std::make_unique<msg>());
std::unique_ptr<msg> data;
if (queue.try_pop(data)) {
// do something with data
}

Data Structures

At the moment the number of provided data structures is rather small since the focus so far was on the reclamation schemes. However, the plan is to add several more data structures in the near future.

Reclamation Schemes

The implementation of the reclamation schemes is based on an adapted version of the interface proposed by Robison [Rob13].

The following reclamation schemes are implemented:

Building

xenium is a header only library, so in order to use it, it is sufficient to include the xenium folder in your list of include directories. No other 3rd party libraries are required. However, the implementation uses C++17 features, so a compiler with sufficient C++17 support is required. The following compilers are used in the CI builds and are therefore known to be supported:

The unit test require googletest and the benchmarks require taocpp/json and taocpp/config. These dependencies are included as submodules, so the unit tests and/or the bencmarks can be built as follows:

1 git clone https://github.com/mpoeter/xenium.git && cd xenium
2 git submodule update --init --recursive
3 mkdir build && cd build
4 cmake ..
5 make gtest
6 make benchmark

References

[Bro15] Trevor Alexander Brown. Reclaiming memory for lock-free data structures: There has to be a better way. In Proceedings of the 2015 ACM Symposium on Principles of Distributed Computing (PODC), pages 261–270. ACM, 2015.
[CL05] David Chase and Yossi Lev. Dynamic circular work-stealing deque. In Proceedings of the 17th Annual ACM Symposium on Parallelism in Algorithms and Architectures (SPAA), pages 21–28. ACM, 2005.
[Fra04] Keir Fraser. Practical lock-freedom. PhD thesis, University of Cambridge Computer Laboratory, 2004.
[Har01] Timothy L. Harris. A pragmatic implementation of non-blocking linked-lists. In Proceedings of the 15th International Conference on Distributed Computing (DISC), pages 300–314. Springer-Verlag, 2001.
[HMBW07] Thomas E. Hart, Paul E. McKenney, Angela Demke Brown, and Jonathan Walpole. Performance of memory reclamation for lockless synchronization. Journal of Parallel and Distributed Computing, 67(12):1270–1285, 2007.
[KLP13] Christoph Kirsch, Michael Lippautz, and Hannes Payer. Fast and scalable, lock-free k-FIFO queues. In Proceedings of the International Conference on Parallel Computing Technologies (PaCT), pages 208–223, Springer-Verlag, 2013.
[Mic02] Maged M. Michael. High performance dynamic lock-free hash tables and list-based sets. In Proceedings of the 14th Annual ACM Symposium on Parallel Algorithms and Architectures (SPAA), pages 73–82. ACM, 2002.
[Mic04] Maged M. Michael. Hazard pointers: Safe memory reclamation for lock-free objects. IEEE Transactions on Parallel and Distributed Systems, 15(6):491–504, 2004.
[MS95] Maged M. Michael and Michael L. Scott. Correction of a memory management method for lock-free data structures. Technical report, University of Rochester, 1995.
[MS96] Maged M. Michael and Michael L. Scott. Simple, fast, and practical non-blocking and blocking concurrent queue algorithms. In Proceedings of the 15th Annual ACM Symposium on Principles of Distributed Computing (PODC), pages 267–275. ACM, 1996.
[Nik19] Ruslan Nikolaev A scalable, portable, and memory-efficient lock-free fifo queue. In Proceedings of the 33rd International Symposium on Distributed Computing (DISC), 2019.
[PT18a] Manuel Pöter and Jesper Larsson Träff. Brief announcement: Stamp-it, a more thread-efficient, concurrent memory reclamation scheme in the C++ memory model. In Proceedings of the 30th Annual ACM Symposium on Parallelism in Algorithms and Architectures (SPAA), pages 355–358. ACM, 2018.
[PT18b] Manuel Pöter and Jesper Larsson Träff. Stamp-it, a more thread-efficient, concurrent memory reclamation scheme in the C++ memory model. Technical report, 2018.
[Ram16] Pedro Ramalhete. FAAArrayQueue - MPMC lock-free queue (part 4 of 4). Blog, November 2016.
[RC15] Pedro Ramalhete and Andreia Correia. Left-Right - A Concurrency Control Technique with Wait-Free Population Oblivious Reads. October 2015
[RC17] Pedro Ramalhete and Andreia Correia. Brief announcement: Hazard eras - non-blocking memory reclamation. In Proceedings of the 29th Annual ACM Symposium on Parallelism in Algorithms and Architectures (SPAA), pages 367–369. ACM, 2017.
[Rob13] Arch D. Robison. Policy-based design for safe destruction in concurrent containers. C++ standards committee paper, 2013.
[Val95] John D. Valois. Lock-Free Data Structures. PhD thesis, Rensselaer Polytechnic Institute, 1995.
[Vyu08] Dmitry Vyukov. Scalable hash map. Google Groups posting, 2008.
[Vyu10] Dmitry Vyukov. Simple and efficient bounded MPMC queue. Google Groups posting, 2010.