From owner-freebsd-current Fri Oct 13 15:33:19 2000 Delivered-To: freebsd-current@freebsd.org Received: from pcnet1.pcnet.com (pcnet1.pcnet.com [204.213.232.3]) by hub.freebsd.org (Postfix) with ESMTP id 3D16137B671 for ; Fri, 13 Oct 2000 15:33:15 -0700 (PDT) Received: (from eischen@localhost) by pcnet1.pcnet.com (8.8.7/PCNet) id SAA05650 for freebsd-current@freebsd.org; Fri, 13 Oct 2000 18:32:55 -0400 (EDT) Date: Fri, 13 Oct 2000 18:32:55 -0400 (EDT) From: Daniel Eischen Message-Id: <200010132232.SAA05650@pcnet1.pcnet.com> To: freebsd-current@freebsd.org Subject: Recent thread changes Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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