https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80878

--- Comment #4 from admin_public at liblfds dot org ---
I've had a look at the libatomic source code.  Obviously, it's problematic to
be sure you're understanding a large code base correctly when you go to it for
the first time and you're looking something specific, so forgive me if I am
here completely mistaken!

I think I understand you Jonathan to mean that in the absence (by whatever
means) of the native instruction, a replacement is provided, which has a
different internal mechanism.

>From what I can see in the libatomic code (and I may be completely wrong!),
this internal mechanism under POSIX is a mutex.

One of the advantages of lock-free data structures is that when properly
written, they scale well.  This advantage will absolutely and most certainly no
longer exist if the native instruction is replaced by an alternative, as there
are, as far as I know, no alternatives on any platforms which will continue to
allow the scaling properties of the native instruction.

In other words, libatomic is absolutely no use to lock-free data structures. 
This is not a fatal problem, as inline assembly can be used.

(Also, lock-free data structures do not sleep, where a mutex can, and that does
change the behaviour of the code, for there are some places in some kernels
where you are not permitted to sleep.)

Reply via email to