Questions tagged [atomic]
An atomic operation is one which can be considered, from the perspective of the computing context in which it occurs, to be executed in a single step. Atomic operations either succeed entirely or fail, with no intermediate states.
69 questions
5
votes
3
answers
491
views
Single Consumer Single Producer Wait-Free Zero-Copy Circular Message Queue
The title describes pretty well what the algorithm is for. It will be used for a realtime inter-process communication library that only uses shared memory for exchanging data. For realtime systems, it'...
9
votes
4
answers
2k
views
Lock-free ring buffer
I implemented lock-free ring buffer from scratch. As I am a beginner in atomic features in C++, I wanted to hear your feedback and possible ordering issues if there are.
...
7
votes
1
answer
486
views
Is this a correct implementation of atomic reference counting in C?
Giving the following constraints, is the optimization in this code correct?
before an object is transfered to another thread, its reference count is incremented and ...
4
votes
1
answer
71
views
A shared ticket lock that is fair for readers and writers
I'm writing a very simple, shared ticket lock whose goal is to be fair for both readers and writers in the order they arrive.
Everyone gets in the same line
Line-contiguous reader groups get ...
1
vote
1
answer
28
views
Basic Hybrid Logical Clock in Rust Performance Improvements?
I needed a very basic hybrid linear clock implementation for a project implementing MVCC. It gives me a perfectly incrementing clock that I can use to compare timestamps that can handle high load ...
5
votes
3
answers
543
views
C11 zero copy lock-free triple buffer
The code is for a single producer, single consumer scenario, where the consumer only cares about the latest information shared by the producer.
This is just a simple proof of concept created for linux....
0
votes
1
answer
149
views
C++ slim condition notifier
When writing multi-threading code, one often need the thread to wait for some condition being met. A naive approach would look like this:
...
1
vote
1
answer
331
views
Lock Guard Atomic alternative
I've recently written a Vulkan library for creating 2D applications with ease. The catch was I need std::lock_guard for my window resize event to resize resources ...
1
vote
1
answer
170
views
Implementation of a lock free queue using CompareAndSwap in Go
Here is my implementation of a lock free queue using CompareAndSwap operation.
...
3
votes
2
answers
301
views
atomic spinlock mutex class
This here is the follow-up to this question. I was recommended to implement a Lockable type (similar to std::mutex) that can work with ...
8
votes
3
answers
2k
views
Basic RAII spinlock class
I have written the following class that acts as a simple lock for mutual exclusion:
...
1
vote
1
answer
220
views
Lock-free implementation of getAndUpdate() using atomic CAS (Compare-And-Swap) operation
We have the following class written in Kotlin Native with the new Memory Manager (which doesn't require to freeze objects):
...
4
votes
2
answers
2k
views
Mutually exclusive execution using std::atomic?
I am currently learning more about lock free programming and wondered how I could implement mutual exclusion using std::atomics. I implemented the following code to ...
0
votes
1
answer
345
views
Flippable atomic boolean
I was trying to implement a boolean that can be atomically flipped.
The suggestion on Stack Overflow is to use an integer.
This would be my implementation.
...
3
votes
2
answers
501
views
C++11 revised `std::latch` implementation
This question follows up on this question.
After turning the while-loop into a conditional wait using std::condition_variable, I ...