CppCon 2015: Fedor Pikus PART 1 “Live Lock-Free or Deadlock (Practical Lock-free Programming)"
Why Stack Overflow recommends it
Stack Overflow users link it when answering questions about volatile, memory visibility and thread-safe data structures, since it explains these concurrency pitfalls clearly.
Recommended by 3 people across 3 different months, 2016 to 2022.
What it is
Part 1 of Fedor Pikus's CppCon 2015 talk introduces lock-free programming in C++: how it differs from lock-based code, when to use it and when not to, and the basic tools involved. It works through simple examples and then a lock-free list to show how complex the problem gets. Part 2 moves to practical, limited designs such as concurrent queues.
What people said
Recommends Craig Estey · 2016-04 · Stack Overflow · on “OpenMP: don't use hyperthreading cores (half `num_threads()` w/ hyperthreading)”
If you were running under Linux [also assuming an x86 arch], you could look at /proc/cpuinfo . There are two fields cpu cores and siblings . The first is number of [real] cores and the latter is the number of hyperthreads. (e.g. on my system they are 4 and 8 respectively for my four core hyperthreaded machine). Because Linux can detect this [and from the link in Zulan's comment], the information is also available from the x86 cpuid instruction. Either way, there is also an environment variable for this: OMP_NUM_THREADS which may be easier to use in conjunction with a launcher/wrapper script One thing you may wish to consider is that beyond a certain number of threads, you can saturate the me
Recommends avp · 2018-03 · Stack Overflow · on “Can I force cache coherency on a multicore x86 CPU?”
It's common misconception, volatile does not mean "to refresh from memory". Check the video about lock-free from Fedor Pikus, he describes "volatile" as well. [this video]
Recommends nvf · 2022-01 · Stack Overflow · on “Singleton with read-only and write access”
It's not so easy if you want thread safe implementation to avoid data race and memory leak. Presentation on the topic --> [this video]