Why is Linux thread locking so slow?

Jeff Sturm jsturm@sigma6.com
Tue Oct 19 10:35:00 GMT 1999


Xavier Leroy wrote:
> > Therefore, I don't believe it is unreasonable for us to think about an
> > SMP lock implementation that optimizes the handling of contended locks
> > in order to make the penalty not as harsh.
> 
> Sure, but I doubt you can get what you want within the LinuxThreads
> implementation model at least (i.e. 1-to-1 threads being scheduled by
> the kernel).  Actually, I'd encourage Java implementors to develop
> their own two-level scheduling, using LinuxThreads threads as their
> "execution engines", and scheduling the Java code in userland on top
> of that.  Or, lobby the Linux kernel developers until they take
> two-level scheduling seriously and provide the necessary kernel
> support for writing a general-purpose two-level POSIX thread
> implementation. (Good luck.)

Ugh.  Two-level scheduling sounds complex and painful to implement...
but I think it's been done before (on Linux) in Netscape's NSPR
library.  The code is part of Mozilla, in case anyone's interested...

-- 
Jeff Sturm
jsturm@sigma6.com


More information about the Java mailing list