ARM SoC launched with Linux support (Linux Devices)
Posted Jan 13, 2009 21:08 UTC (Tue) by
npitre (subscriber, #5680)
In reply to:
ARM SoC launched with Linux support (Linux Devices) by endecotp
Parent article:
ARM SoC launched with Linux support (Linux Devices)
> In my experience, with some thought you can often get quite reasonable
> code by trying to implement the algorithm directly in terms of atomic
> swap (i.e. the one atomic operation that ARMv5 has), rather than by
> writing the code using e.g. atomic add and then trying to implement
> atomic add on top of swap. I think I had futex-based mutex and
> condition code that did this.
That certainly works for things like semaphores where you're expected
to go to sleep on contention. However, for simple atomic primitives such
as atomic adds and the like, relying on futexes for arbitration is rather
heavy weight, whereas the technique currently implemented in ARM Linux
for those is extremely light and has no contention issue at all.
Nevertheless, a simple swap instruction, along with futexes, allows
for pretty efficient semaphore support. For example, see my implementation
here (if I'm not mistaken, you are the one I replied to in that message).
That implementation, unfortunately, is not POSIX compliant as it is not
safe wrt concurrent usage from signal handlers.
(
Log in to post comments)