Skip to main content

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.

5votes
2answers
435views

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'...
mausys's user avatar
9votes
4answers
2kviews

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. ...
Cabbas's user avatar
7votes
1answer
486views

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 ...
João Pires's user avatar
4votes
1answer
71views

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 ...
Michael220's user avatar
1vote
1answer
28views

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 ...
Sienna's user avatar
5votes
3answers
542views

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....
mausys's user avatar
0votes
1answer
149views

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: ...
zwhconst's user avatar
1vote
1answer
331views

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 ...
FatalSleep's user avatar
1vote
1answer
170views

Implementation of a lock free queue using CompareAndSwap in Go

Here is my implementation of a lock free queue using CompareAndSwap operation. ...
Tauseef Ahmad's user avatar
3votes
2answers
301views

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 ...
digito_evo's user avatar
8votes
3answers
2kviews

Basic RAII spinlock class

I have written the following class that acts as a simple lock for mutual exclusion: ...
digito_evo's user avatar
1vote
1answer
220views

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): ...
Volo's user avatar
  • 111
4votes
2answers
2kviews

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 ...
dvnlo's user avatar
0votes
1answer
345views

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. ...
Antonio's user avatar
3votes
2answers
501views

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 ...
noes's user avatar

153050per page
close