Questions tagged [lock-free]

An umbrella term for methods and algorithms to synchronize multithreaded environments or other forms of distributed system without using locks.

13 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
5
votes
0answers
159 views

Yet another multi-producer single consumer queue in C++17

Here's an implementation of a multi-producer single consumer queue that I wanted to use with tasks such as logging from multiple points in a program to a single sink. The implementation is inspired ...
5
votes
0answers
2k views

Disruptor pattern in a lock-free producer-consumer queue

I'm implementing a quick-and-dirty lock-free MPMC queue in C++, based on the v3 Disruptor algorithm. The implementation is pretty simple: Data to be shared between threads is stored in a ring buffer. ...
4
votes
0answers
44 views

C++14 AtomicRoundRobinPool for sharing a pool of keys

The idea here is that we have some resource that is relatively very expensive to generate, but once we have a bunch of them in a pool, we can keep reusing them instead of generating new ones. "HTTP ...
4
votes
0answers
192 views

An in-memory copy of the GDAX order book for an arbitrary cryptocurrency, updated in real time

GDAX is the cryptocurrency exchange owned and operated by Coinbase. This code is intended to be the basis for an order-book-strategy trading bot. I'd love feedback on my use of data structures, my ...
3
votes
0answers
73 views

shared_mutex prototype implementation

Anyone feels to review a prototype C++11 shared_mutex implementation? Not recursive, not protected and potentially dangerous if used incorrectly, but allegedly fast in case of many R/O less R/W ...
3
votes
0answers
47 views

Fast lock implementation using pipes only

For fun I wanted to create a lock implementation that was about as fast as one using futexes but that used used pipes instead and that queues waiters in user space instead of in-kernel. For the queue ...
2
votes
0answers
57 views

Lock-free pooled queue

I am attempting to create a lock free pool of resources and I need the ability to access any one that is not already accessed and then return it back when I do not need it. This will happen very very ...
2
votes
0answers
362 views

A multithreaded, growable vector with immutable elements, which has wait-free reads

I wrote a small vector with a few lines of unsafe Rust. The idea is to have a vector, which can be read from simultaneously, but it needs the ability to grow. To realize that, the storage is ...
2
votes
0answers
98 views

Lock-free statically allocated async-interrupt-safe multi-consumer double buffer

I have a single threaded embedded system with nested interrupts. A writer interrupt will periodically update some global data structure with data. Reader interrupts / calls from main thread will read ...
2
votes
0answers
88 views

SPSC job scheduling with lockfree workqueue and abortable jobs

Since I had not found exactly what I was looking for I wrote some simple workqueue-based job system myself that is based on boost's lock-free queue. It is supposed to be used in some GUI application ...
2
votes
0answers
481 views

Concurrent resizable ring buffer

I'm trying to find the fastest way to enqueue and dequeue items concurrently in Go. There are some restrictions: it needs to be unbounded Memory allocation should be low Multiple producers (Single ...
2
votes
0answers
264 views

Implementation of a lock-free fixed-sized allocator - follow-up - with commented code

The following implementation of a lock-free fixed-size allocator is a follow-up of: Implementation of a lock-free fixed-sized allocator §1 - Introduction The purpose is self-learning of atomic ...
1
vote
0answers
531 views

Lock-free segmented shared memory buffer in C++

Summary The code operates three memory mapped file segments: just finished currently active next to write Potentially slow operations of closing just finished and opening next to write are done in ...