Pthreads performance

From: Maxim Sobolev <sobomax_at_portaone.com>
Date: Fri, 11 Feb 2005 17:06:31 +0200
Hi,

Note: I am purposely posting this to developers to avoid banging into 
"FreeBSD 5/6 is slow" drum. My pthreads knowellege is pretty basic, so 
that it's possible that this all is false alarm.

I've found a post on some of Russian technical forums in which author 
tries to compare performance of basic synchronisation primitives in 
various threading packages available on FreeBSD. The interesting part is 
that the linuxthreads clearly wins by a high margin - difference between 
it and the next follower (kse) is almost 3x. I had tried to find some 
error in the program logic, but failed. Another interesting thing is 
that libthr, which is conceptually very close to linuxthreads, provides 
worst result, being 8x slower than LT and almost 3x slower than kse/c_r.

For those who can read Russian the original post can be found here: 
http://www.opennet.ru/base/sec/test_freebsd_threads.txt.html

Following is result of the run on my 5.3-STABLE/UP.

-bash-2.05b$ time ./aqueue_c_r -n 10000000
pusher started
poper started

real    0m17.826s
user    0m17.766s
sys     0m0.048s
-bash-2.05b$ time ./aqueue_thr -n 10000000
pusher started
poper started

real    0m46.227s
user    0m18.706s
sys     0m27.423s
-bash-2.05b$ time ./aqueue_kse -n 10000000
pusher started
poper started

real    0m15.477s
user    0m15.432s
sys     0m0.009s
-bash-2.05b$ time ./aqueue_linuxthreads -n 10000000
pusher started
poper started

real    0m6.118s
user    0m2.217s
sys     0m0.932s
-bash-2.05b$

Test case and script that compiles it can be found there:

http://www.portaone.com/~sobomax/aqueue.c
http://www.portaone.com/~sobomax/build.sh

-Maxim
Received on Fri Feb 11 2005 - 14:06:40 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:28 UTC