Comment by mettamage

1 day ago

I was having dinner with a friend yesterday who told me that lock free data structures aren’t lock free since they lock on the hardware level. He also had a thing to say about compilers in C++.

He said something like: it’s crazy that you have the C++ standard but then also how a compiler implements that standard. And then it still matters how that compiler is implemented on a particular architecture! It’s always different and the annoying thing is that this is permutative. This is why we use X86-64 Intel CPUs at <name company> and <name compiler> (I forgot the name). That simplifies it but you still need to know 3 things. He also was frustrated how lock free data structures and memory reordering are 2 completely different concepts in practice but not in C++ but I didn’t fully follow him. I wrote 100 hours in C++ so I was already happy I understood everything else.

But based on his rant I can sort of see why compilers feel not deterministic.