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

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 [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message

Reply via email to