From owner-freebsd-smp Tue Feb 26 20:30:29 2002 Delivered-To: freebsd-smp@freebsd.org Received: from goose.prod.itd.earthlink.net (goose.mail.pas.earthlink.net [207.217.120.18]) by hub.freebsd.org (Postfix) with ESMTP id BEA8A37B41D; Tue, 26 Feb 2002 20:30:24 -0800 (PST) Received: from pool0115.cvx22-bradley.dialup.earthlink.net ([209.179.198.115] helo=mindspring.com) by goose.prod.itd.earthlink.net with esmtp (Exim 3.33 #1) id 16fvj9-0004yf-00; Tue, 26 Feb 2002 20:30:03 -0800 Message-ID: <3C7C60BA.3FBDB9A0@mindspring.com> Date: Tue, 26 Feb 2002 20:29:46 -0800 From: Terry Lambert X-Mailer: Mozilla 4.7 [en]C-CCK-MCD {Sony} (Win98; U) X-Accept-Language: en MIME-Version: 1.0 To: Bob Van Valzah Cc: Robert Watson , Jorge Aldana , Garance A Drosihn , smp@FreeBSD.ORG Subject: Re: Performance vs. Stable References: <1014782526.15635.22.camel@Relent.Bob.WhiteBarn.Com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-smp@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org Bob Van Valzah wrote: > On Tue, 2002-02-26 at 21:50, Robert Watson wrote: > > What is the 'null system call'? > > It looks like Larry was a bit fast and loose with language in writing > the summary report (maybe to make it fit in the header). It appears to > be the time needed to write one byte to /dev/null. I don't see why > that's any more "null" than say, getpid(). It makes you cross the user/kernel boundary. Smart systems implement things that never change, like getpid, as: static struct _saved { pid_t s_pid; } cached_state = { -1 }; pid_t getpid(void) { pid_t rv = cached_state.s_pid; if( s_pid == -1) rv = system_getpid(); return rv; } ... fork() ... cached_state.s_pid = -1; /* reset cache on fork */ Thus such calls have zero system call overhead. Similar shortcuts can be had for other read-values, such as getgid, getgroups, etc., etc. (hacks required in the set call wrapper for fork, etc., obviously). Using a write of /dev/null is an attempt to work around this; of course, you could special case that, as well, in user space, but it'd be more work than Larry thinks most people will go to to cheat on the benchmark (Hi Larry! 8-)). -- Terry To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-smp" in the body of the message