system call overhead

Wojciech Puchar wojtek at wojtek.tensor.gdynia.pl
Sun May 11 03:38:48 PDT 2014


did a simple test under FreeBSD/amd64 on intel atom 1.8GHz

#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
main() {
  int a;
  for(a=0;a<10000000;a++) read(0,(void*)&a,0);
}


takes over 5 seconds (10^10 cycles) to execute system call doing nothing 
10^7 times. it did this in a loop so even no cache refill effect should 
make a difference.

so 1000 CPU cycles on 2-way superscalar in-order CPU per system call with 
everything in L1 cache. for me it is way too much.

Huge overhead of passing through ancient x86 gate descriptors are not 
present - FreeBSD uses syscall instruction.

i found that doing other system calls that too do - in effect - nothing, 
doesn't change that figure much.

tried to browse FreeBSD sources and found it quite complex.

As i for now don't have dragonfly installed on real computer at present 
(VM is not a place to make good test) so could anyone perform that test on 
dragonfly?



More information about the Users mailing list