atomic operations under linux

atomic operations under linux

Shachar Shemesh shachar at shemesh.biz
Thu Dec 10 11:19:45 IST 2009


Gilboa Davara wrote:
>
> Why?
> - Write code that can run more-or-less the same as kernel module and as
> a user-space library. (And under multiple different OS')
> - Implement fast spinlocks and/or RW locks in user mode. (Again, that
> behave the same under kernel mode and user mode.)
> - Atomic counters.
> - Anything else that can use the "lock" prefix.
>
> - Gilboa
>   
I'll just point out that all of the above only make sense if you are 
guaranteed low contention. If not, using the OS supplied locking 
mechanisms will bring much better performance, due to the fact that 
locked tasks do not take CPU time (are scheduled out).

If you can guarantee extremely low contention, yes, there is *SOME* 
sense. If not, I think this is premature optimization.

Shachar

-- 
Shachar Shemesh
Lingnu Open Source Consulting Ltd.
http://www.lingnu.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.cs.huji.ac.il/pipermail/linux-il/attachments/20091210/a2c1ca5b/attachment.html>


More information about the Linux-il mailing list