Sharlinon Hacker News • Recommends
On “Swift Atomics”
7.9K subscribers • 3 videos on Hallway
Advanced. Deep dive for people who know the field.
71K views8 years ago4 recommendations
Systems programmingProgramming languagesC++Concurrency and parallelismMemory management
Herb Sutter explains the C++11 memory model, hardware ordering, and how atomic operations work under the hood.
channel9.msdn.com/Shows/Going+Deep/Cpp-and-Beyond-2012-Herb-… Download the slides. 1drv.ms/b/s!Aq0V7yDPsIZOgcI0y2P8R-VifbnTtw Abstract: This session in one word: Deep. It's a session that includes topics I've publicly said for years is Stuff You Shouldn't Need To Know and I Just Won't Teach, but it's becoming achingly clear that people do need to know about it. Achingly, heartbreakingly clear, because some hardware incents you to pull out the big guns to achieve top performance, and C++ programmers just are so addicted to full performance that they'll reach for the big red levers with the flashing warning lights. Since we can't keep people from pulling the big red levers, we'd better document the A to Z of what the levers actually do, so that people don't SCRAM unless they really, really, really meant to. Topics Covered: * The facts: The C++11 memory model and what it requires you to do to make sure your code is correct and stays correct. We'll include clear answers to several FAQs: "how do the compiler and hardware cooperate to remember how to respect these rules?", "what is a race condition?", and the ageless one-hand-clapping question "how is a race condition like a debugger?" * The tools: The deep interrelationships and fundamental tradeoffs among mutexes, atomics, and fences/barriers. I'll try to convince you why standalone memory barriers are bad, and why barriers should always be associated with a specific load or store. * The unspeakables: I'll grudgingly and reluctantly talk about the Thing I Said I'd Never Teach That Programmers Should Never Need To Now: relaxed atomics. Don't use them! If you can avoid it. But here's what you need to know, even though it would be nice if you didn't need to know it. * The rapidly-changing hardware reality: How locks and atomics map to hardware instructions on ARM and x86/x64, and throw in POWER and Itanium for good measure – and I'll cover how and why the answers are actually different last year and this year, and how they will likely be different again a few years from now. We'll cover how the latest CPU and GPU hardware memory models are rapidly evolving, and how this directly affects C++ programmers. For more information see alexsmail.blogspot.com/2017/11/c-and-beyond-2012-herb-sutter…What people say. Recommended as the definitive deep dive into the C++ memory model and atomic operations.
Sharlinon Hacker News • Recommends
On “Swift Atomics”
NobodyNadaon Hacker News • Recommends
On “C++ Memory Model: Migrating from x86 to ARM”
zevvon Hacker News • Recommends
On “Making Sense of Acquire-Release Semantics”
chc4on Hacker News • Recommends
On “Rust Atomics and Locks (2023)”
Sharlinon Hacker News • Recommends
On “C++ Concurrency Model on x86 for Dummies (2020)”
u/Nervous_Recursionin r/C_Programming • Mentions
On “Where can one learn about Std threads, Atomic operations, lock free / wait free programming as well as distributed parallel programming where each core has its own memory space that is total mem / total core in C?”
u/skyb0rgin r/C_Programming • Mentions
On “Help with debugging a multi-thread data structure - Understanding TSan”
u/AnonymousMorrisin r/C_Programming • Mentions
On “Learning programming isn't like Math.”