From owner-freebsd-performance@FreeBSD.ORG Sun Jun 22 19:59:32 2003 Return-Path: Delivered-To: freebsd-performance@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id C329437B401 for ; Sun, 22 Jun 2003 19:59:32 -0700 (PDT) Received: from stoneport.math.uic.edu (stoneport.math.uic.edu [131.193.178.160]) by mx1.FreeBSD.org (Postfix) with SMTP id D354D43F3F for ; Sun, 22 Jun 2003 19:59:31 -0700 (PDT) (envelope-from djb-dsn-1056337204.40078@cr.yp.to) Received: (qmail 40079 invoked by uid 1017); 23 Jun 2003 03:00:04 -0000 Date: 23 Jun 2003 03:00:04 -0000 Message-ID: <20030623030004.40078.qmail@cr.yp.to> Automatic-Legal-Notices: See http://cr.yp.to/mailcopyright.html. From: "D. J. Bernstein" To: freebsd-performance@freebsd.org References: <20030621185821.30070.qmail@cr.yp.to> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Subject: Re: ten thousand small processes X-BeenThere: freebsd-performance@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Performance/tuning List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Jun 2003 02:59:33 -0000 alloca() is inadequate. Memory allocation doesn't always follow a stack pattern. I certainly can't predict memory use at the top of main(). sbrk() is dangerous. Suppose a system call that I'm using turns into a library routine that calls malloc()---this has happened to poll() and to socket(), so it could happen again. Suppose the malloc() implementor assumes that the memory he gets from sbrk() is contiguous. Kaboom. (If the sbrk() manual page said that this was the malloc() implementor's fault, maybe I'd risk it. But the manual page clearly says I shouldn't. ``Duh, why would anyone want to use more than one allocator library?'') Even if I get malloc() under control somehow, I'll still have 30-odd unexplained VM pages going down the tubes. Is this, in fact, the stack? Why doesn't it start at 4K? ---D. J. Bernstein, Associate Professor, Department of Mathematics, Statistics, and Computer Science, University of Illinois at Chicago