Why is Linux thread locking so slow?

Tom Tromey tromey@cygnus.com
Fri Oct 8 13:51:00 GMT 1999


>>>>> "Matt" == Matt Welsh <mdw@cs.berkeley.edu> writes:

Matt> However, I can't seem to duplicate the same problem when writing
Matt> a simple pthreads program in C -- the C program performance
Matt> doesn't decrease anywhere near as badly as Java. I believe I am
Matt> using the same locking mechanisms in C as are used in GCJ.

They are basically the same.  Any difference should be much smaller
than the effect you are seeing.

Someone (I don't remember who) has said here that Linux Threads uses
spin locks for mutexes -- apparently it doesn't yield when trying to
acquire a lock.  I haven't looked at the source to see if this is the
case, but if it is then it would seem to explain your problem.

Tom


More information about the Java mailing list