struct { void* node; void* next; };
struct { size_t length; void* data};
First, the standard does not define a 128-bit integer type. It's an extension that some compilers provide and others don't.
In a lock-free algorithm you often need to perform more than one atomic op, so the cost quickly starts to pile up to the point where it is cheaper to use a spin-lock or a different algorithm that involves smaller types.
I don't think 32-bit ARM architectures can be called antiques.
128-bit CAS is considerably more costly than 32-bit or 64-bit ones.
Not sure what you mean by "platform-relative locks".
Again, not sure what you mean.
--
--- You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-discussio...@isocpp.org.
To post to this group, send email to std-dis...@isocpp.org.
Visit this group at https://groups.google.com/a/isocpp.org/group/std-discussion/.
The interface for atomic ops in C++ is atomic<>, which can be instantiated with a type that has size of 16 bytes even in the absence of int128_t
gave you an example of a wide spread architecture that does not have that support. Clearly you are wrong in your assumptions.
It will. Have a look at the numbers:
In most cases you want to protect a larger region of code, and blocking instead of spinning is often more preferable choice.
There are no instructions for 128-bit exclusive load/store.
You mean the context swiches? Or terminating a thread? Anyway, I don't see how anything of that is better with spin locks - quite the contrary.
From: Nemo Yu Sent: Sunday, January 17, 2016 9:17 AM Reply To: std-dis...@isocpp.org Subject: Re: [std-discussion] Atomic & Lockless: does std::atomic support int128_t completely and locklessly? |
As someone said at CppCon "Lock-free programming is hard. Correct lock-free programming is even harder."(if anyone knows who said that, let me know - I heard it second hand, but want to give credit where credit is due)
The other LL/SC architectures I have manuals for (MIPS, SPARC, PowerPC) do not
have this type of instruction.
128-bit CAS is considerably more costly than 32-bit or 64-bit ones.
No offense, the cost of 128-bit CAS will not be much greater than 64-bit
CAS or 32-bit CAS.
It will. Have a look at the numbers:
http://www.agner.org/optimize/instruction_tables.pdf
Fedor Pikus (https://youtu.be/lVBvHbJsg5Y?t=249)