This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: installing the <atomic.h> header?


On Thu, Nov 4, 2010 at 8:11 PM, Petr Baudis <pasky@suse.cz> wrote:
> ?IMHO most of this stuff is not really a kernel service or worth a
> library routine, but just making use of your instruction set properly.
> So a compiler matter, solved not too badly with
>
> ? ? ? ?http://gcc.gnu.org/onlinedocs/gcc-4.5.0/gcc/Atomic-Builtins.html
>
> ?I don't think the extra layer of <atomic.h> convenience routines is
> all that significant; and no kernel calls are wrapped by this, AFAICS.

Petr,

On a purely techincal note, some architectures do provide wrappers for
kernel helper routines. However, no userspace application should ever
call them, they should use the the GCC atomic builtins as you suggest.

Some architectures require kernel arbitration depending on the way in
which the ISA matches or does not match the implemented atomic
operation. As two examples: On HP PA-RISC the ISA only defines "load
and clear word", and the kernel always arbitrates a compare and swap
using a light-weight syscall mechanism. On ARM for anything older than
ARMv6 you use a kernel helper to complete a compare and exchange
operation (or memory barrier).

Cheers,
Carlos.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]