Date: Tue, 05 Jun 2012 19:40:13 +0200 From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= <des@des.no> To: John Baldwin <jhb@freebsd.org> Cc: Gianni <gianni@freebsd.org>, Alan Cox <alc@rice.edu>, Alexander Kabaev <kan@freebsd.org>, Attilio Rao <attilio@freebsd.org>, Konstantin Belousov <kib@freebsd.org>, freebsd-arch@freebsd.org, Konstantin Belousov <kostikbel@gmail.com> Subject: Re: Fwd: [RFC] Kernel shared variables Message-ID: <868vg1verm.fsf@ds4.des.no> In-Reply-To: <201206051222.12627.jhb@freebsd.org> (John Baldwin's message of "Tue, 5 Jun 2012 12:22:12 -0400") References: <CACfq090r1tWhuDkxdSZ24fwafbVKU0yduu1yV2%2BoYo%2BwwT4ipA@mail.gmail.com> <201206051008.29568.jhb@freebsd.org> <86haupvk4a.fsf@ds4.des.no> <201206051222.12627.jhb@freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
John Baldwin <jhb@freebsd.org> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?868vg1verm.fsf>