Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 11 Feb 2005 17:06:31 +0200
From:      Maxim Sobolev <sobomax@portaone.com>
To:        "developers@freebsd.org" <current@freebsd.org>
Subject:   Pthreads performance
Message-ID:  <420CC9F7.40802@portaone.com>

next in thread | raw e-mail | index | archive | help
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



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