From owner-freebsd-arch@FreeBSD.ORG Tue Jun 5 17:40:16 2012 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DEDEF10656E8; Tue, 5 Jun 2012 17:40:16 +0000 (UTC) (envelope-from des@des.no) Received: from smtp.des.no (smtp.des.no [194.63.250.102]) by mx1.freebsd.org (Postfix) with ESMTP id 37A748FC12; Tue, 5 Jun 2012 17:40:15 +0000 (UTC) Received: from ds4.des.no (smtp.des.no [194.63.250.102]) by smtp.des.no (Postfix) with ESMTP id 3E1F760A6; Tue, 5 Jun 2012 17:40:14 +0000 (UTC) Received: by ds4.des.no (Postfix, from userid 1001) id D346E962F; Tue, 5 Jun 2012 19:40:13 +0200 (CEST) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: John Baldwin References: <201206051008.29568.jhb@freebsd.org> <86haupvk4a.fsf@ds4.des.no> <201206051222.12627.jhb@freebsd.org> Date: Tue, 05 Jun 2012 19:40:13 +0200 In-Reply-To: <201206051222.12627.jhb@freebsd.org> (John Baldwin's message of "Tue, 5 Jun 2012 12:22:12 -0400") Message-ID: <868vg1verm.fsf@ds4.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: Gianni , Alan Cox , Alexander Kabaev , Attilio Rao , Konstantin Belousov , freebsd-arch@freebsd.org, Konstantin Belousov Subject: Re: Fwd: [RFC] Kernel shared variables X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Jun 2012 17:40:17 -0000 John Baldwin writes: > Yes, we know getpid() is slow, I think the question is does it matter tha= t=20 > it's slow in something other than a microbenchmark. Can you name the=20 > application that you've seen use getpid()? I've seen it in a proprietary multi-platform shared memory library. Closer to home, I believe sqlite3 does the same thing, and we do this ourselves, albeit on a smaller, non-performance-critical scale, e.g. in the pidfile API and (IIRC) in nsswitch and the resolver. BTW, raise(0) was a poor choice of baseline since it actually calls getpid(), which makes no difference on Linux but does on FreeBSD. The actual numbers for FreeBSD are: getpid(): 10,000,000 iterations in 784,638 ms gettimeofday(0, 0): 10,000,000 iterations in 801,375 ms kill(pid, 0): 10,000,000 iterations in 1,190,791 ms DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no