From owner-freebsd-hackers@FreeBSD.ORG Fri Oct 28 11:11:29 2011 Return-Path: Delivered-To: hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DF491106564A for ; Fri, 28 Oct 2011 11:11:29 +0000 (UTC) (envelope-from dcherednik@masterhost.ru) Received: from mail.corp.masterhost.ru (wincas02.mail.corp.masterhost.ru [90.156.219.212]) by mx1.freebsd.org (Postfix) with ESMTP id 5AB108FC13 for ; Fri, 28 Oct 2011 11:11:29 +0000 (UTC) Received: from kzholnay-pc.masterhost.ru (87.242.97.5) by mail.corp.masterhost.ru (90.156.219.210) with Microsoft SMTP Server (TLS) id 14.1.339.1; Fri, 28 Oct 2011 15:00:29 +0400 Message-ID: <4EAA8B4B.2090002@masterhost.ru> Date: Fri, 28 Oct 2011 15:00:27 +0400 From: Daniil Cherednik User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.18) Gecko/20110617 Lightning/1.0b2 Thunderbird/3.1.11 MIME-Version: 1.0 To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [87.242.97.5] Cc: Subject: performance of fork() syscalls X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Oct 2011 11:11:30 -0000 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 Features2=0x641d AMD Features=0x20000800 TSC: P-state invariant real memory = 4294967296 (4096 MB) avail memory = 4113141760 (3922 MB) ACPI APIC Table: 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