News for hackers. Stuff that matters.
Re:A fast multi-producer, multi-consumer lock-free concurren... by gambiting on Monday December 05, 2016 @06:46AM (#13104799)
I've been to a C++11 presentation on multithreading recently, and x86 CPUs guarantee that all reads/writes on from std::atomic are indeed, atomic and they always happen in order they were called in. Code generated on ARM guarantees that even multi-byte reads/writes happen in one instruction, but there's no guarantee on the order.
Re:A fast multi-producer, multi-consumer lock-free concurren... by gpderetta on Monday December 05, 2016 @07:05AM (#13104871)
> x86 CPUs guarantee that all reads/writes on from std::atomic are indeed, atomic

... for sizeof(T) <= 64 bits on amd64.

128 bit is technically supported (thanks to the availability DCAS) but stores and especially loads are significantly more expensive (as there are no native atomic 128 bit load and store), even in relaxed modes. Also, as even loads perform write cycles, they can't be used on read-only memory.

Anything larger uses, IIRC, a spinlock pool and is not lock-free.

/pedantic