Fine-grained locking for POSIX local sockets (UNIX domain sockets)

Tim Kientzle kientzle at freebsd.org
Wed May 10 00:31:44 UTC 2006


David Xu wrote:
> On Wednesday 10 May 2006 02:23, Kris Kennaway wrote:
> 
>>There are at least several issues here:
>>
>>...This may be general issues like
>>gettimeofday() on Linux vs FreeBSD; clearly there is something *very
>>big* to blame here.  Mysql does do *lots* of such calls ...
> 
> My last recall is that gettimeofday is not a syscall on Linux...

I recall Matt talking about implementing gettimeofday()
without a syscall.  The basic idea is to have the kernel
record some constants in a page that's mapped across
all processes, then libc can just read the time from
a known location.

It might be nice to combine this with some of the
other ideas being tossed around here:
   * On each clock tick, store a base time in
a known location (page mapped read-only, no-execute
across all memory maps)
   * libc can just read the base time (accurate
to the clock rate) from a constant.  Very, very fast.
   * For higher resolution, the kernel could record
TSC and CPU clock speed data (per-CPU? Hmmm...)
and libc could use that to fine-tune the time?

Still some details I need to think through...

Tim


More information about the freebsd-performance mailing list