From owner-freebsd-arch Wed Aug 21 8:57:57 2002 Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 976AA37B400 for ; Wed, 21 Aug 2002 08:57:55 -0700 (PDT) Received: from harmony.village.org (rover.bsdimp.com [204.144.255.66]) by mx1.FreeBSD.org (Postfix) with ESMTP id A681643E4A for ; Wed, 21 Aug 2002 08:57:54 -0700 (PDT) (envelope-from imp@bsdimp.com) Received: from localhost (warner@rover2.village.org [10.0.0.1]) by harmony.village.org (8.12.3/8.12.3) with ESMTP id g7LFvrFl023295; Wed, 21 Aug 2002 09:57:54 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Wed, 21 Aug 2002 09:57:26 -0600 (MDT) Message-Id: <20020821.095726.109035410.imp@bsdimp.com> To: rizzo@icir.org Cc: nbm@mithrandr.moria.org, arch@FreeBSD.ORG Subject: Re: ugliness in rc.* scripts From: "M. Warner Losh" In-Reply-To: <20020821061822.A56560@iguana.icir.org> References: <20020820232538.A53816@iguana.icir.org> <20020821074819.GA58163@mithrandr.moria.org> <20020821061822.A56560@iguana.icir.org> X-Mailer: Mew version 2.1 on Emacs 21.2 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG In message: <20020821061822.A56560@iguana.icir.org> Luigi Rizzo writes: : On Wed, Aug 21, 2002 at 09:48:19AM +0200, Neil Blakey-Milner wrote: : ... : > > This would be easily fixed by moving /usr/bin/tr to /bin/tr (statically : > > linked) and doing : > > : > > tolower() { : > > echo `tr A-Z a-z <<_EOF : > > $*` : > > } : > > : > > case `tolower ${some_config_variable}` in : > > mixed_case_string) : ... : > I believe the argument for 'case' and those mixed case strings is that : > it doesn't spawn a process, whereas "if [ " did at the time. Using : > 'echo' and 'tr' and two ``'s will spawn four shells (or something like : > that). : : i think it is only one process -- echo is a builtin, tolower is a shell : function. In any case, we never cared about performance in the rc scripts, : not spawning processes (e.g. calling scripts with . instead of sh) has : only to do with letting variable assignements be visible in the caller. Actually, we have cared about the performance of shell scripts in the past. NetBSD got a nasty surprise when they went to their new rc system when they started greatly increasing the number of forks in the boot process. Some machines went from taking 10 seconds to boot to taking 30 minutes. They fixed this in two ways: 1) by reducing the number of forks in the rc scripts and 2) by fixing bugs in that architecture that make fork insanely slow. We still need to boot fast enough that things aren't insanely slow on a 32MB 66MHz 486. There's enough embedded people doing embedded things that will likely want 5.0 that we have to keep that in mind. The company I work for has systems with 133MHz 486-class CPUs that we ship with 32MB RAM. Warner To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message