From mboxrd@z Thu Jan 1 00:00:00 1970 From: dexen deVries To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Date: Sat, 19 Feb 2011 18:25:21 +0100 User-Agent: KMail/1.13.5 (Linux/2.6.38-rc5-30+; KDE/4.5.5; x86_64; ; ) References: <1b61f389440311188b1c018fae979214@quintile.net> In-Reply-To: <1b61f389440311188b1c018fae979214@quintile.net> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201102191825.21690.dexen.devries@gmail.com> Subject: Re: [9fans] Modern development language for Plan 9, WAS: Re: RESOLVED: recoving important header file rudely Topicbox-Message-UUID: b1cae87a-ead6-11e9-9d60-3106f5b1d025 On Saturday 19 of February 2011 11:34:19 Steve Simon wrote: > > Benchmark utilities to measure the overhead of syscalls. It's cheating > > to do for getpid, but for other things like gettimeofday, it's > > *extremely* nice. Linux's gettimeofday(2) beats the socks off of the > > rest of the time implementations. About the only faster thing is to > > get CPU speed and use rdtsc. Certainly no other OS allows you to get > > the timestamp faster with a syscall. > > Here is where my memory gets hazy, however Solaris 2 had a very fast > implementation of gettimeofday(), it was still a syscall I think but > had a shortcut in the kernel. > > This was added (If I rembember correctly) to get a database (Sybase > I think) to run on Solaris 2 as fast as it always used to run on SunOS. > This was commented in the code as a special, ugly hack as a result of > extreme pressure from an important customer. > > I wonder if Linux inherited the hack from Solaris? Perhaps the concept of providing very fast gettimeofday() at the cost of using an uncommon implementation, but not necessarily the actual implementation. Linux' gettimeofday() /is not a syscall/ at all. Devon posted the following earlier: > The high level overview is that it is stored in a shared page, mapped > into each new process's memory space at start-up. The kernel is never > entered; there are no context switches. The kernel has a timer that > updates this page atomically. > > --dho -- dexen deVries ``One can't proceed from the informal to the formal by formal means.''