Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 13 Oct 2000 18:32:55 -0400 (EDT)
From:      Daniel Eischen <eischen@vigrid.com>
To:        freebsd-current@freebsd.org
Subject:   Recent thread changes
Message-ID:  <200010132232.SAA05650@pcnet1.pcnet.com>

next in thread | raw e-mail | index | archive | help

I've just committed some changes to the threads library
and would appreciate feedback from anyone running threaded
applications.  They include fixes that -stable could really
use.

This commit also implements zero system call thread context
switching in the threads library.  Switching between threads
is now much faster than before this change.  At the end is a
performance test for thread switches.  The test program
creates 10 threads that do nothing but pthread_yield().  Please
realize that this is not an example of a typical application.
Some applications may not see any noticeable improvement.

The range of valid priorities has also changed, perhaps
requiring a library version bump.  The range of valid priorities
is not visible outside of the threads library.  The only
way it can be determined is through trial and error, so
it _shouldn't_ be an issue.

BTW, _PTHREADS_INVARIANTS is the default for a while until
I'm sure there aren't any major problems.  The performance
hit should be negligible.  Edit src/lib/libc_r/Makefile to
turn it off.

       Before                             After
-------------------------------------------------------------
Thread 0 iterations: 35400       Thread 0 iterations: 259131
Thread 1 iterations: 35400       Thread 1 iterations: 259131
Thread 2 iterations: 35399       Thread 2 iterations: 259131
Thread 3 iterations: 35399       Thread 3 iterations: 259130
Thread 4 iterations: 35399       Thread 4 iterations: 259130
Thread 5 iterations: 35399       Thread 5 iterations: 259130
Thread 6 iterations: 35399       Thread 6 iterations: 259130
Thread 7 iterations: 35399       Thread 7 iterations: 259130
Thread 8 iterations: 35399       Thread 8 iterations: 259130
Thread 9 iterations: 35399       Thread 9 iterations: 259130
Total iterations: 353992         Total iterations: 2591303

real    0m10.043s                real    0m10.153s
user    0m3.558s                 user    0m9.947s
sys     0m6.445s                 sys     0m0.010s


-- 
Dan Eischen


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200010132232.SAA05650>