Clarification Of -jX Argument For buildworld/kernel

Kevin Oberman rkoberman at
Thu Jul 22 20:57:48 UTC 2021

On Thu, Jul 22, 2021 at 1:17 AM Herbert J. Skuhra <herbert at> wrote:

> On Wed, 21 Jul 2021 16:17:11 +0200, Tim Daneliuk wrote:
> >
> > Is it still advisable to explicitly declare the numer of make processes
> > when doing buildworld/buildkernel
> Sure, why not!?
> > or are the defaults best left alone?
> If something breaks try the defaults.
> > I am trying to suss through a 13-STABLE build problem to see if using -j4
> > on a 4 core machine is causing a race condition of some sort...
> Even when you build world/kernel with -j4 there should be an error
> message. What is it? If you can't find it build without -j4. If it
> still fails post the error here or on the stable mailing list.
> I build world and kernel (stable/13 and main) for amd64, armv7 and
> arm64 with -j4 and have no issues.
> --
> Herbert

While it may have changed, the defaut was originally to build on one
processor, it may have changed, but I don't think so.

Several years ago someone did some testing and demonstrated that the best
performance was using number of threads + 2, but that was at least 12 years
ago and systems topped out at 8 or 16 threads while far more are available
today. It is likely that  improvements may be seen with higher numbers for
very large systems.

If you wonder why more prarrallel build that threads is better, on an 8
thread system (like mine), if I set '-j8', only a maximum of 8 threads will
attempt to run even though one or more processors may be idle while waiting
for I/O. Having  couple of added threads available means that this idle
time is available for another thread. If you set the value to be equal to
the available hardware threads, there won't be one.

In the many years since parallel world/kernel builds were introduced,
issues have been very rare, though mistakes have occasionally happened. I
really would not worry too much about races.
Kevin Oberman, Part time kid herder and retired Network Engineer
E-mail: rkoberman at
PGP Fingerprint: D03FB98AFA78E3B78C1694B318AB39EF1B055683

More information about the freebsd-questions mailing list