lock-free Questions
2
Solved
There is a part in the C++ standard about multi-threading memory model that I don't understand.
A visible side effect A on a scalar object or bit-field M with respect to a value computation B of M...
Swinge asked 18/4, 2020 at 0:23
7
Solved
Anecdotally, I've found that a lot of programmers mistakenly believe that "lock-free" simply means "concurrent programming without mutexes". Usually, there's also a correlated misunderstanding that...
Unsearchable asked 27/8, 2017 at 16:50
5
Solved
I am thinking about implementing a lock free circular array. One problem is maintaining the head and tail pointers in a lock free manner. The code I have in mind is:
int circularIncrementAndGet(At...
Lusty asked 2/1, 2014 at 19:42
1
Can somebody explain the usage of WRITE_ONCE and READ_ONCE?
And internally WRITE_ONCE uses a volatile qualifier. Why?
How does WRITE_ONCE and READ_ONCE solve cache coherency problem?
Difference bet...
Leff asked 29/5, 2018 at 17:2
1
Solved
I'm experimenting with C++ atomic's std::atomic<T>::is_always_lock_free and std::atomic<T>::is_lock_free.
I wrote a simple struct A and want to know if the atomic version of A is lock-f...
12
Solved
Can anyone provide a good explanation of the volatile keyword in C#? Which problems does it solve and which it doesn't? In which cases will it save me the use of locking?
Condolent asked 16/9, 2008 at 13:39
3
Recently when I was reading about lock-free programming, I came across "atomic operations". I started digging deep into it. All links explain how to write atomic operations and their usag...
4
Solved
I wanted to understand what does one mean by lock_free property of atomic variables in c++11. I did googled out and saw the other relevant questions on this forum but still having partial understan...
5
Solved
I'm quite new in multithreading programming, I just know the most common Producer-Consumer-Queue.
I'm using the boost c++ libraries and I don't know if is better use boost::lockfree::queue or a wr...
Incarnation asked 29/4, 2013 at 9:20
7
Solved
In C++, there is one atomic type std::atomic<T>. This atomic type may be lock-free or maybe not depending on the type T and on the current platform. If a lock-free implementation for a type i...
Ietta asked 28/2, 2023 at 21:47
2
Solved
I'm trying to write a subj queue, but I get deadlocks and other multithreading problems. I want to use Interlocked.CompareExchange to avoid lock usage. But this code doesn't work as expected: it ju...
Stelu asked 7/9, 2015 at 9:29
11
Raymond Chen has been doing a huge series on lockfree algorithms. Beyond the simple cases of the InterlockedXxx functions, it seems like the prevailing pattern with all of these is that they implem...
Esdraelon asked 15/4, 2011 at 18:28
5
Solved
Can I use an Interlocked.* synchronization method to update a DateTime variable?
I wish to maintain a last-touch time stamp in memory. Multiple http threads will update the last touch DateTime vari...
Congest asked 7/10, 2009 at 13:31
6
Solved
(This is a repeat of: How to correctly read an Interlocked.Increment'ed int field? but, after reading the answers and comments, I'm still not sure of the right answer.)
There's some code that ...
Padre asked 17/7, 2014 at 15:56
1
Solved
Brief Description:
The code below is an implementation of a lock-free queue from C++ Concurrency in Action 2nd Edition. The queue uses a linked list as the underlying data structure and is implemen...
Filagree asked 19/10, 2022 at 15:4
2
Solved
There are three different types of "lock-free" algorithms. The definitions given in Concurrency in Action are:
Obstruction-Free: If all other threads are paused, then any given
thread wi...
Palawan asked 28/5, 2022 at 13:14
3
Solved
Given the following:
class Foo
{
public:
void Increment()
{
_InterlockedIncrement(&m_value); // OSIncrementAtomic
}
long GetValue()
{
return m_value;
}
private:
long m_value;
};
Is ...
Griffey asked 2/4, 2022 at 14:5
2
A lock-free stack can be implemented as a singly linked list. This seems simple until we have to think about what to do with nodes after they've been popped. One strategy is to simply move them to ...
6
Solved
I'm currently reading C++ Concurrency in Action book by Anthony Williams and there are several lock free data structures implementations. In the forward of the chapter about lock free data structur...
Ibidem asked 27/10, 2016 at 13:45
2
Solved
I have a ring buffer that looks like:
template<class T>
class RingBuffer {
public:
bool Publish();
bool Consume(T& value);
bool IsEmpty(std::size_t head, std::size_t tail);
bool I...
Talca asked 28/12, 2021 at 20:51
3
Solved
My understanding of std::memory_order_acquire and std::memory_order_release is as follows:
Acquire means that no memory accesses which appear after the acquire fence can be reordered to before the...
Sequestered asked 24/4, 2016 at 15:1
1
Solved
I have the following code:
#include <atomic>
int main () {
std::atomic<uint32_t> value(0);
value.fetch_add(1, std::memory_order::relaxed);
static_assert(std::atomic<uint32_t>:...
4
Can anyone tell me whether std::atomic<T>::is_lock_free() isn't static as well as constexpr? Having it non-static and / or as non-constexpr doesn't make sense for me.
Why wasn't it designed l...
Chaotic asked 12/11, 2019 at 10:0
1
Solved
I am reading C++ concurrency in action 2nd.
It introduces split reference counts for a lock free stack.
One possible technique involves the use of not one but two reference counts for each node: a...
Unwitting asked 3/5, 2021 at 14:51
3
Solved
I am studying Michael & Scott's lock-free queue algorithm and trying to implemented it in C++.
But I produced a race in my code and think there may be a race in the algorithm.
I read the paper ...
Liking asked 26/11, 2016 at 12:47
1 Next >
© 2022 - 2024 — McMap. All rights reserved.