lockless Questions

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

1

Solved

Given: std::atomic<uint64_t> x; uint64_t f() { x.store(20, std::memory_order::memory_order_relaxed); x.store(10, std::memory_order::memory_order_relaxed); return x.load(std::memory_order:...

1

Solved

On x86, atomic RMW instructions like lock add dword [rdi], 1 are implemented using cache locking on modern CPUs. So a cache line is locked for duration of the instruction. This is done by getting t...
Clinkerbuilt asked 12/5, 2020 at 5:31

4

Solved

I get the feeling this may be a very general and common situation for which a well-known no-lock solution exists. In a nutshell, I'm hoping there's approach like a readers/writer lock, but that do...
Dendrite asked 15/4, 2020 at 20:4

0

According to Intel's manual (on page 112): void _mm_pause(void) The execution of the next instruction is delayed an implementation specific amount of time. The instruction does not mod...
Kenley asked 17/10, 2019 at 3:2

1

Solved

I would like to cobble together a uint64 atomic counter from atomic uint32s. The counter has a single writer and multiple readers. The writer is a signal handler so it must not block. My idea is t...
Wellfixed asked 9/2, 2019 at 21:35

1

Solved

I have been trying to Google my question but I honestly don't know how to succinctly state the question. Suppose I have two threads in a multi-core Intel system. These threads are running on the s...
Headache asked 11/7, 2018 at 19:12

1

Solved

I am trying to implement a thread-safe lockless container, analogous to std::vector, according to this https://software.intel.com/en-us/blogs/2008/07/24/tbbconcurrent_vector-secrets-of-memory-organ...
Brade asked 16/10, 2017 at 1:48

2

I would like to wait on an event in my app which supposed to happen immediately, so I don't want to put my thread on wait and wake it up later. I wonder what are the difference between using Sleep(...
Exaggerated asked 20/9, 2011 at 16:2

6

Solved

I was thinking, is it possible to have a lockless queue when more than one thread is reading or writing? I've seen an implementation with a lockless queue that worked with one read and one write th...
Shanan asked 11/6, 2010 at 6:28

1

Solved

I am implementing a lock-free queue based on this algorithm, which uses a counter to solve the ABA problem. But I don't know how to implement this counter with c++11 CAS. For example, from the algo...
Argon asked 16/8, 2016 at 20:44

2

Solved

According to MSDN, the Stopwatch class instance methods aren't safe for multithreaded access. This can also be confirmed by inspecting individual methods. However, since I only need simple "time e...
Ursulaursulette asked 13/6, 2016 at 21:46

1

Solved

While reading Albahari's Threading in C#, I've noticed that the "lock free update" pattern uses a SpinWait at the end of the cycle: static void LockFreeUpdate<T> (ref T field, Func <T, T&...
Bulletproof asked 13/6, 2016 at 21:24

2

Solved

In some articles about algorithm, some use the word lockfree, and some use lockless. What's the difference between lockless and lockfree? Thanks! Update http://www.intel.com/content/dam/www/publi...
Nicky asked 9/12, 2013 at 9:30

1

Solved

I'm experimenting with the C++11 atomic primitives to implement an atomic "thread counter" of sorts. Basically, I have a single critical section of code. Within this code block, any thread is free ...
Palladium asked 7/8, 2014 at 17:33

2

Solved

I have multiple threads that need to consume data from a TCP stream. I wish to use a circular buffer/queue in shared memory to read from the TCP socket. The TCP receive will write directly to the c...
Calvincalvina asked 2/7, 2012 at 14:16

1

I have a problem that requires me to use a highly concurrent, wait free implementation of a stack. I have to preallocate all memory (no garbage collection or mallocs) in advance and it is acceptabl...
Soldiery asked 17/1, 2013 at 22:33

2

Solved

Go's buffered channel is essentially a thread-safe FIFO queue. (See Is it possible to use Go's buffered channel as a thread-safe queue?) I am wondering how it's implemented. Is it lock-free li...
Milklivered asked 27/10, 2012 at 18:19

3

Solved

Consider the following attempt at a lockless hashtable for multithreaded search algorithms (inspired by this paper) struct Data { uint64_t key; uint64_t value; }; struct HashEntry { uint64_t k...
Fresno asked 20/9, 2012 at 7:16

3

Solved

I have a generic field and a property that encapsulates it: T item; public T Item { get { return item; } set { item = value; } } The problem is that this property can be written to from one t...
Frick asked 18/7, 2012 at 15:1

2

I'm progressing in my Clojure quest (about 80 problems solved on 4clojure.com) and I keep on reading and coding and trying to "get it". Now I'm a bit confused by Clojure being designed for "lockle...
Attainment asked 14/6, 2012 at 11:14

4

Solved

Is there such a thing as an atomic |= or and atomic or? If no what is the recommended technique for setting a bit in an variable that needs to be threadsafe? (I am avoiding locks)
Toile asked 25/6, 2011 at 17:1

1

Say we have a single-producer-thread single-consumer-thread lockless queue, and that the producer may go long periods without producing any data. It would be beneficial to let the consumer thread s...
Whiskey asked 21/11, 2010 at 0:12

1

Solved

I have lockless queues written in C in form of a linked list that contains requests from several threads posted to and handled in a single thread. After a few hours of stress I end up having the la...
Janicejanicki asked 26/4, 2010 at 17:28

5

Solved

I've spent today looking into lockless queues. I have a multiple producer, multiple consumer situation. I implemented, for testing, a system using the Interlocked SList thing under Win32 and it dou...
Darell asked 12/11, 2009 at 19:13

© 2022 - 2024 — McMap. All rights reserved.