On Thu, 2009-12-10 at 11:19 +0200, Shachar Shemesh wrote: > 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
I fully agree. Using spinlocks to lock small segment of code that needs 5-20 CPU cycles and has 10% of hitting contention is wise, doing the same on a 2000 cycle segment with 50% of hitting spinning is stupid. - Gilboa _______________________________________________ Linux-il mailing list [email protected] http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il
