OpenBSD 4.3
#include <sys/time.h>
double GetAbsTimer() {
struct timespec ts;
int result=clock_gettime(CLOCK_REALTIME,&ts);
if (result!=0) exit(1);
return ts.tv_sec + ts.tv_nsec*1e-9;
}
The time precision is about 1.3 microseconds.
Fedora 9:
The docs say you can use CLOCK_REAL_TIME_HR after including
The time step is also 1.3 microseconds.
Token passing test: parent process opens a pipe, forks a child. In a loop, write a byte to the pipe. The child reads the byte and writes it back. Repeat a few hundred thousand times. Results:
Windows 64
Note that Windows pipes don't get anywhere close to that number.
QueueUserAPC is the method of choice on Windows, and we're testing switching between two threads in the same process space (which is a valid test, because thread is how you parallelize stuff on Windows, not processes).
OpenBSD 4.3
ThinkPad T60 (2.3mhz Core duo): 130K roundtrips/sec (56.5K switces/mhz)
Linux 2.6.23
ThinkPad T60 (2.3mhz Core duo): 22K roundtrips/sec (9.5 K switches/mhz). *HORRIBLE*
That's right, 1/25th of the speed. Don't let anyone tell you virtualization is efficient. It's cool, but it's not efficient.
AMD Athlon 64 3200+ (2ghz), 2.6.23.8-34 kernel: 171K switches/sec (85K swiches/mhz)
Notes: cat /proc/cpuinfo, uname -a
Some conclusions:
1. Linux sucks at context switching on Intel chips
2. Linux rules at context switching on AMD chips, especially Opteron
3. OpenBSD is faster than Linux on intel chips
Blog Archive
Monday, June 23, 2008
Measuring context switching speed of different OSs
VirtualBox guest additions on Fedora, Ubuntu
Fedora:
yum -y install binutils gcc make kernel-headers kernel-devel
Ubuntu:
sudo apt-get install build-essential
sudo apt-get install linux-headers-`uname -r`
I haven't run OpenBSD under VirtualBox, but on that OS the package installer is pkg_add. As in,
pkg_add -v ftp://ftp.openbsd.org/pub/OpenBSD/4.3/packages/i386/xemacs-21.4.19p5.tgz
Subscribe to:
Posts (Atom)