~/talk

Best Practices for Concurrency

Talkat Meeting C++ 2018 · 2018-11-15..11-17· [rust]
slides:none on file

Shows concrete failures and fixes: a reader‑writer example that silently writes via map default initialization and produces a data race; summing 100 million elements where a naive lock guard slows four threads to less than 2× because of RAM contention; use local aggregation, atomics only when appropriate, and expect Amdahl limits. Recommends tools: ThreadSanitizer for races, cppmem to enumerate interleavings and visualize the memory model, and existing lock‑free libraries like Boost.Lockfree rather than rolling custom ABA‑prone structures. Also notes futures destructor blocking, jthread interrupt tokens, and prefer tasks over raw threads.

AI-written summary · about

  1. 0:00Intro
  2. 0:47Best Practices for Concurrency
  3. 1:28Code Reviews
  4. 4:13Minimise Sharing
  5. 7:01Minimise Waiting (Amdahl's Law)
  6. 8:23Use Code Analysis Tools (ThreadSanitizer)
  7. 10:48Use Code Analysis Tools (CppMem)
  8. 16:52Use Pure Functions
  9. 20:58Use Tasks instead of Threads
  10. 23:10Don't use Fire and Forget Futures
  11. 27:19Cooperative Interruption of std::thread
  12. 29:16Use Tasks instead of Condition Variables
  13. 32:23Condition Variables are hard to use
  14. 34:29Pack Mutexes into Locks
  15. 36:40Minimal Locking
  16. 42:28Don't Program lock-free: ABA
  17. 45:14Use Proven Patterns
  18. 49:02Don't Reinvent the Wheel
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.