Fwd: [RFC] Kernel shared variables
Dag-Erling Smørgrav
des at des.no
Tue Jun 5 17:40:17 UTC 2012
John Baldwin <jhb at freebsd.org> writes:
> Yes, we know getpid() is slow, I think the question is does it matter that
> it's slow in something other than a microbenchmark. Can you name the
> 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
--
Dag-Erling Smørgrav - des at des.no
More information about the freebsd-arch
mailing list