Tagged Questions

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

learn more… | top users | synonyms

2
votes
2answers
84 views

Multithreaded lock-free queue implementation

My partner and I are beginning to believe there could be a desync possibility in the lock free queue we have written, but we would like some fresh eyes on the subject. What are your thoughts on our ...
2
votes
1answer
58 views

Lockless, blocking, non synchronized multiple producers and consumers ring buffer

My program is structured like this: there are M producer threads, each of which computes a section of an object O with index ...
4
votes
2answers
200 views

Lock-free multiple producer single consumer message queue

For a while now I've been after a lock-free, simple and scalable implementation of a multiple producer, single consumer queue for delegates in C#. I think I finally have it. I've run basic tests on it ...
4
votes
0answers
148 views

Testing a lock-free job queue

I've created a lock-free job queue and with the tests I've written, which is also very fast. That makes me doubt my benchmark procedure, so I'm hoping the collective knowledge will shed some light on ...
3
votes
1answer
165 views

Lock-free queue with doubly linked list correctness

I need a lock-free queue which is implemented by doubly linked list. Is my code correct? Are there any errors? Are there any improvements to be made? linkedlist.h ...
4
votes
1answer
232 views

Single consumer and single producer lock-free circular buffer

I'm pretty new to multithreading. The code below is a simple implementation of a single consumer/single producer circular buffer that does not use any locking, that I wrote for fun. The question ...
2
votes
0answers
90 views

(nearly) lock-free job queue of dynamic size (multiple read/write)

Warning: the code below is NOT multi read/write! It'l work fine as long as you don't have multiple writes OR don't require resize. But with multiple writers, the code can enter a deadlock state. I'm ...
5
votes
1answer
196 views

lock-free job queue without size restriction (multiple read/write)

I've since come up with an improved version, which isn't technically lock-free, but might be as close as you can get (nearly) lock-free job queue of dynamic size (multiple read/write) code below is ...
4
votes
1answer
264 views

Lockfree ThreadPool implementation

How could this template class ThreadPool be improved? I use Boost queue to keep std::function's numbers from ...
5
votes
1answer
118 views

CountdownLatch Thread-Safety Check

I've written this class as an exercise for a synchronization construct to be used across multiple threads. The intent is to have worker threads Increment() it, do ...
7
votes
1answer
391 views

Lockless Queue Multiple-Reader Singler-Writer in C++

I wrote a lockless queue for sending small objects from a single thread to a random worker thread. Assumptions: x86/x86_64 compiled with GCC one thread may Write(), multiple threads may Read() ...
10
votes
1answer
383 views

Play some sine waves with SDL2

Runs smoothly, however valgrind is showing "possibly lost: 544 bytes in 2 blocks". This is my first time doing a lot of things here so I might be making multiple mistakes. Please let me know if ...
8
votes
1answer
305 views

Low-lock Multi-threading Implementation

I'm designing in my spare time a game engine (for fun, not so much for profit, haha). I wanted to design the 'core pipeline' as efficiently as possible. Having a quad-core CPU, I decided to take ...
1
vote
0answers
98 views

Multi producer/consumers lockfree list

As per similar question Multi producer/consumers lockfree stack, following a lockfree list implementation. Note that this list is pre-defined maximum set of elements which can be inserted (N argument ...
6
votes
4answers
233 views

Valid and safe use of SpinLock in Singleton?

Is this a valid and safe use of .NET's System.Threading.SpinLock? Why am I doing this? Random's public methods are not ...
4
votes
2answers
914 views

Block a thread - spin-lock replacement

I have implemented several lock-free algorithms to maximise throughput but have always baulked when performing a spin-lock. I can usually convince myself that this is the only way but it still nags at ...
4
votes
1answer
262 views

Multi producer/consumers lockfree stack

Can you please take a look at the following x86-64 C++ code which should implement a multi consumer/produce lockfree stack? Do you think I have missed anything? ...
3
votes
0answers
65 views

Is throughput performance of lockfree stack in line with expectations?

As per subject, following a relatively simple C++/gcc/x86-64 implementation of a lockfree stack. I believe the ABA issue should have been fixed in the pop method too; following code for reference. Is ...
2
votes
1answer
74 views

Simple Freelock collection

I wrote simple lock-free collection class for saving items from multithreading code. I did it just for fun and experience. Can you check my code for potentially problems please? ...
5
votes
0answers
3k views

Lock-free multiple-consumer multiple-producer queue

The code below implements an intrusive lock-free queue that supports multiple concurrent producers and consumers. Some features: Producers and consumers work on separate ends of the queue most of ...
2
votes
1answer
187 views

Lock-free DoubleBufferedList

I posted this on SO and would appreciate any ideas on it's stability. Much like the old double-buffering algorithm, this uses a List<T> to which are added ...
2
votes
2answers
1k views

Lock-Free Ring Implementation

I am wondering if someone can take a look at my lock-free, circular ring implementation which I use to implement a background logger. The CircularRing ...
2
votes
1answer
711 views

Publisher/Consumer thread-safe lock-free queue with a single publisher/consumer

The code above is a implementation of a lock-free queue that makes the assumption that there is exactly one Consumer thread and one Producer thread. This works as intended? The memory barriers is used ...
7
votes
1answer
2k views

Thread-safe lock-free counter

I was using such code: ...
12
votes
2answers
772 views

O(1) lock free container?

I posted this code in answer to a question on SO and someone asked if it had been peer-reviewed. It had not so I thought you guys may be able to help. It is a lock-free ...
14
votes
2answers
811 views

Lock-free cache oblivious n-body algorithm

I'm currently looking at, from a rather high level, the parallelization of the gravity calculation in an N-body simulation for approximating a solution to the N-body problem. The simple form of the ...
26
votes
5answers
6k views

Is this (Lock-Free) Queue Implementation Thread-Safe?

I was trying to create a lock-free queue implementation in Java, mainly for personal learning. The queue should be a general one, allowing any number of readers and/or writers concurrently. Would you ...