This is the mail archive of the libc-alpha@sources.redhat.com 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: gcc 4.1 implements compiler builtins for atomic ops


On Sat, Jun 25, 2005 at 07:45:51PM -0700, Anuj Goyal wrote:
> Most modern architectures can do an atomic add or atomic increment in
> less than 10 assembly instructions.  For older architectures (parisc)
> which don't have comparable assembly instructions you would have to
> somehow emulate this in gcc which would be bad --- for this one
> architecture I agree with you that the "atomic" instructions should be
> provided by glibc.

We will be working to implement the atomic ops in gcc on parisc.

For parisc the atomic operation is implemented as a light-weight
syscall, on the gateway page, consisting of 18 instructions on the fast
path. Tests show this is as close to optimal as possible. With scaling
out to ~16 cpus (all on paper though). I could probably re-architect the
light-weight-syscall locking to scale to higher cpus.

This has the unfortunate issue of requiring a newer kernel. I'm not sure
how to handle this type of requirement against gcc. With glibc I could
use a vDSO or --enable-kernel and some package management entries.

The implementation of atomic ops in glibc is exactly the same, just
wrapped around a function call.

Cheers,
Carlos.


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