[zeromq-dev] Does the zeromq support the spin_lock internally?
Stephen Hemminger
shemminger at vyatta.com
Thu Mar 15 01:05:20 CET 2012
On Wed, 14 Mar 2012 19:52:59 -0400
Steven McCoy <steven.mccoy at miru.hk> wrote:
> On 14 March 2012 17:18, Stephen Hemminger <shemminger at vyatta.com> wrote:
>
> >
> > At least on linux there is is pthread_spin_lock()
> >
>
> Linux = pthread_spin_lock()
> OS X = OSSpinLock()
> Win32 = Win32 atomics DIY
> GCC = GCC atomics DIY
> *BSD, Solaris = BSD atomics DIY
>
> Alternative for systems with unaligned support = ticket based spin locks,
> fastest implementation to date.
>
> You can find all these in OpenPGM, I looked around a bit. Also have RW
> spinlocks. Note some implementations are not hyper-thread safe or SMP
> aware. I went a bit extreme and detect available cores at runtime so that
> I also support thread affinity - lock the process to one core and the
> spinlocks wont burn time.
>
> http://code.google.com/p/openpgm/source/browse/trunk/openpgm/pgm/include/impl/thread.h
>
> http://code.google.com/p/openpgm/source/browse/trunk/openpgm/pgm/thread.c
> http://code.google.com/p/openpgm/source/browse/trunk/openpgm/pgm/include/impl/ticket.h
>
>
Of course the best code uses no locks.
Shameless plug for userspace RCU. http://lttng.org/urcu
The recent lock-less hash list is really great.
More information about the zeromq-dev
mailing list