performance of fork() syscalls

Daniil Cherednik dcherednik at masterhost.ru
Fri Oct 28 11:11:30 UTC 2011


Hello.
I have some questions about performance fork syscall.

The simple test:

int main(){
int i;
int pid;
char *test;
signal(SIGCHLD, SIG_IGN);
for (i = 0; i <10000; i++) {
pid = fork();
if (!pid)
return 0;

}
}

Result in FreeBSD (8.2, amd62):

real 0m2.010s
user 0m0.053s
sys 0m1.946s

Result in Linux (2.6.32-5-amd64):

real 0m1.210s
user 0m0.008s
sys 0m1.200s

Of course the machines for test is same.

CPU: Intel(R) Xeon(TM) CPU 3.00GHz (2992.52-MHz K8-class CPU)
Origin = "GenuineIntel" Id = 0xf41 Family = f Model = 4 Stepping = 1
Features=0xbfebfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CLFLUSH,DTS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE>
Features2=0x641d<SSE3,DTES64,MON,DS_CPL,CNXT-ID,CX16,xTPR>
AMD Features=0x20000800<SYSCALL,LM>
TSC: P-state invariant
real memory = 4294967296 (4096 MB)
avail memory = 4113141760 (3922 MB)
ACPI APIC Table: <A M I OEMAPIC >
FreeBSD/SMP: Multiprocessor System Detected: 4 CPUs
FreeBSD/SMP: 2 package(s) x 1 core(s) x 2 HTT threads
cpu0 (BSP): APIC ID: 0
cpu1 (AP/HT): APIC ID: 1
cpu2 (AP): APIC ID: 6
cpu3 (AP/HT): APIC ID: 7

Does this mean performance of fork() in Linux is better? And can you 
explain why?


-- 

С уважением,
Daniil Cherednik
.masterhost



More information about the freebsd-hackers mailing list