NetBSD Thread Switch Performance

From Wikistix

Scheduler activations were removed after 4.0. This shows the impact on thread context switch time, running on an old SPARC. The code simply has two threads fighting over a flip-flop, via a condition wait and associated mutex. Recorded values are the best of several runs.

version thread context switches per second
4.0_BETA 14894.5
4.99.16 10545.0
4.99.72 10075.0
5.99.9 10763.2

Raw output

orac:ksh$ uname -a
NetBSD orac.stix.org.au 4.0_BETA NetBSD 4.0_BETA (ORAC) #0: Tue Oct 17 19:50:31 EST 2006  stix@zion.stix.org.au:/export/netbsd/netbsd-4/obj.sparc/export/netbsd/netbsd-4/src/sys/arch/sparc/compile/ORAC sparc
orac:ksh$ ./pthreadswitch
76801 thread context switches in 5.156345 seconds
14894.5 thread context switches per second
orac:ksh$ uname -a
NetBSD orac.stix.org.au 4.99.16 NetBSD 4.99.16 (ORAC) #0: Sun Mar 25 19:45:39 EST 2007  stix@zion.stix.org.au:/export/netbsd/current/obj.sparc/export/netbsd/current/src/sys/arch/sparc/compile/ORAC sparc
orac:ksh$ ./pthreadswitch 
55297 thread context switches in 5.243912 seconds
10545.0 thread context switches per second
orac:ksh$ uname -a
NetBSD orac.stix.org.au 4.99.72 NetBSD 4.99.72 (ORAC) #0: Thu Aug 21 08:56:22 EST 2008  stix@hex.stix.org.au:/u/netbsd/current/obj.sparc/u/netbsd/current/src/sys/arch/sparc/compile/ORAC sparc
orac:ksh$ ./pthreadswitch
55297 thread context switches in 5.488561 seconds
10075.0 thread context switches per second
orac:ksh$ uname -a
NetBSD orac.stix.org.au 5.99.9 NetBSD 5.99.9 (ORAC) #0: Fri Apr 10 18:43:31 EST 2009  stix@hex.stix.org.au:/u/netbsd/20090403T0002/obj.sparc/u/netbsd/20090403T0002/src/sys/arch/sparc/compile/ORAC sparc
orac:ksh$ ./pthreadswitch 
65537 thread context switches in 6.088976 seconds
10763.2 thread context switches per second