|
gettimeofday() -- user-space vs. system callgettimeofday() -- user-space vs. system callPosted Feb 6, 2007 20:06 UTC (Tue) by AnswerGuy (subscriber, #1256)In reply to: Methodology used by pjm Parent article: Comparing Linux and Minix
While gettimeofday() should be one of the simplest system calls in the
Then the libc can just fetch the relevant data from its own address
This is, of course, a standard memory for speed trade-off. Tridge (of
(Of course it's possible that the effect would be less dramatic on x86
JimD
(Log in to post comments)
gettimeofday() -- user-space vs. system call Posted Feb 7, 2007 9:26 UTC (Wed) by ekj (subscriber, #1524) [Link] The balance tends to shift over time too.The amount of memory available increases a lot more than the available syscalls do. In other words, putting the data that gettimeofday() needs into the address-space of every process costs just as many bytes now as it always did (well, modulus avg number of processess on a box), but the available memory increases exponentially. Lots of stuff may make sense on a 16GB machine which doesn't make sense on a 4MB machine. If you do enough such trickery that you'd have wasted half the RAM of the 4MB machine you'll have wasted 0.01% of the memory of the large machine. If you assume the large machine has 10 times as many processes, you've still only wasted 0.1% of the available memory. This is even more true for space/performance tradeoffs that are internal to the kernel only. Back when Linux was new, wasting 1MB to double in-kernel performance would've been ridicolous. Today it's equally obvious that it'd be a huge win in most scenarios. Gets complicated though, because larger structures tend to hurt cache-hit ratio, and main-memory is *SLOW* compared to on-die-cache.
gettimeofday() -- user-space vs. system call Posted Feb 7, 2007 16:53 UTC (Wed) by nix (subscriber, #2304) [Link] You don't need any libc support for this (other than the existing vsyscall support). The code on the vsyscall page which normally runs SYSENTER could spot that the syscall being invoked is gettimeofday() and copy out the appropriate value from elsewhere in the vsyscall page without ever transitioning to kernel mode. (A patch of this nature was discussed a few years ago, but I'm not sure if any code resulted.)
|
Copyright © 2008, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds
Powered by Rackspace Managed Hosting.