From owner-freebsd-questions Tue Jun 4 13:48:17 2002 Delivered-To: freebsd-questions@freebsd.org Received: from mail.reppep.com (www.reppep.com [64.81.19.108]) by hub.freebsd.org (Postfix) with ESMTP id 6470A37B404; Tue, 4 Jun 2002 13:48:04 -0700 (PDT) Received: from [129.85.219.160] (salt.rockefeller.edu [129.85.219.160]) by mail.reppep.com (Postfix) with ESMTP id 7922417C0A; Tue, 4 Jun 2002 15:49:44 -0400 (EDT) Mime-Version: 1.0 X-Sender: pepper@mail.reppep.com Message-Id: In-Reply-To: <200206040427.VAA18855@beta.tricity.wsu.edu> References: <200206040427.VAA18855@beta.tricity.wsu.edu> Date: Tue, 4 Jun 2002 16:42:20 -0400 To: Mark Smith From: Chris Pepper Subject: Re: make -j4 becoming default? Cc: freebsd-questions@FreeBSD.ORG, freebsd-doc@freebsd.org Content-Type: text/plain; charset="us-ascii" ; format="flowed" Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG At 9:27 PM -0700 2002/06/03, Mark Smith wrote: > > Obviously, I'd like to use -j4 wherever possible, and it's >> suboptimal to try everything multi-threaded, then sometimes fail and >> manually fall back to single-threaded. Even worse, I usually forget >> -j4 for thread-safe builds, so I waste time unnecessarily. > >Why? I've tried make buildworld with different -j options and, >on a single processor computer, they're slower than not using -jn >at all. > >In this case, the handbook may be wrong. If you have the time, try >"time make buildworld" and "time make -j4 buildworld" in both single >and multiuser mode and look at the "real" time for all 4. In my >experience on my box, "make buildworld" under multiuser mode is >the fastest. Mark, It looks like you're right. "time make buildworld" produced these timings. 1676.438u 473.492s 38:00.61 94.2% 1420+1582k 19522+10171io 2431pf+0w 1668.499u 470.581s 37:29.41 95.0% 1425+1588k 15703+10167io 2482pf+0w "time make -j4 buildworld" produced these timings, so multi-threaded building on my 1.1GHz Celeron w/ 384mb RAM is about 14% slower than single-threaded. 1682.883u 505.357s 43:11.26 84.4% 1403+1569k 14515+119482io 1442pf+0w 1678.557u 508.144s 43:23.59 83.9% 1403+1568k 17533+119444io 2319pf+0w It looks like the Handbook is wrong in this case. Is there general agreement that -j is useless on single-CPU systems? If so, I'll provide a doc patch. Thx, Chris Pepper >Run > > # make buildworld > >It is now possible to specify a -j option to make which will cause >it to spawn several simultaneous processes. This is most useful on >multi-CPU machines. However, since much of the compiling process is >IO bound rather than CPU bound it is also useful on single CPU >machines. > >On a typical single-CPU machine you would run: > > # make -j4 buildworld > >make(1) will then have up to 4 processes running at any one time. >Empirical evidence posted to the mailing lists shows this generally >gives the best performance benefit. -- Chris Pepper: Rockefeller University: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message