# I/O & CPU scheduling, jobs & cores... and performance, baby

**URL:** https://discourse.nixos.org/t/i-o-cpu-scheduling-jobs-cores-and-performance-baby/66120
**Category:** Help
**Created:** [June 26, 2025, 6:52pm UTC](https://discourse.nixos.org/t/i-o-cpu-scheduling-jobs-cores-and-performance-baby/66120 "2025-06-26T18:52:02Z")
**Posts on this page:** 1
**Showing post:** 4

<div class="post-metadata">

### Author: ![justinas](https://discourse.nixos.org/user_avatar/discourse.nixos.org/justinas/32/30061_2.png) [@justinas](https://discourse.nixos.org/u/justinas)
#### Post date: [June 28, 2025, 12:01am UTC](https://discourse.nixos.org/t/i-o-cpu-scheduling-jobs-cores-and-performance-baby/66120/4 "2025-06-28T00:01:53Z")

</div>

> [@frozen.frog23](#):
>
> by default, `nix.settings.cores` is `0`, which is to _use all available LOGICAL (not threads) cores_,

You got this one backwards. A hyper-threaded processor, advertised as, say, having 8 cores and 16 threads (2 threads per core) has 8 _physical_ cores, but 16 _logical_ cores, i.e. “hardware threads”. A Linux system will mostly report this as “16 cores”, without distinction. `htop` will show individual load for 16 cores, `/proc/cpuinfo` will list 16 cores. [See also this question](https://unix.stackexchange.com/questions/88283/so-what-are-logical-cpu-cores-as-opposed-to-physical-cpu-cores).

> [@frozen.frog23](#):
>
> but… then it says this:
> 
> > Some builds may become non-deterministic with this option; use with care!
> 
> what does THAT mean?

My understanding is that this refers to the fact that certain compilers or compiling certain codebases may not produce bit-for-bit identical output, or compilation may outright fail when you allow them to compile several parts of the code in parallel, but will produce a consistent result if you compile stuff sequentially.

> [@frozen.frog23](#):
>
> which has `enableParallelBuilding` inside of it? uhm, why would it not have that? im just curious, please do tell! 😭

[`enableParallelBuilding` seems to be the default](https://github.com/NixOS/nixpkgs/issues/142338) for any package that uses `stdenv` (which is the majority of packages in `nixpkgs`). Notably, this issue lists a bunch of issues that were previously present when building certain packages in parallel. You can also use [GitHub code search](https://github.com/search?q=repo%3ANixOS%2Fnixpkgs%20enableParallelBuilding%20%3D%20false&type=code) to find packages where parallel building is still explicitly disabled due to issues.

I think the [documentation you linked](https://nix.dev/manual/nix/2.24/advanced-topics/cores-vs-jobs) is pretty clear. `max-jobs` defines how many derivations will be built in parallel (at the same time) - the Nix daemon itself takes care of this. `cores` defines how many “cores” may be utilized while building each _one_ of those derivations, and it is up to the derivation to respect this (e.g. by running `make -j$NIX_BUILD_CORES` - the `cores` setting is exposed to the derivation as the `NIX_BUILD_CORES` environment variable).

The funny thing I realized is that NixOS sets _both_ `max-jobs` and `cores` to `auto` or `0`, meaning they will both default default to the number of logical cores. So for a CPU with 16 threads you will potentially have `16 * 16 = 256` build processes. There’s [been discussion about improving this](https://github.com/NixOS/nixpkgs/issues/198668), but there’s no consensus yet, it seems.

> [@frozen.frog23](#):
>
> EDIT: oh btw speaking of concurrent tasks. is it possible somehow to change the amount of SIMULTANEOUS DOWNLOADS per build/update?

Looks like [`max-substitution-jobs`](https://nix.dev/manual/nix/2.26/command-ref/conf-file.html#conf-max-substitution-jobs) is what you need. I don’t blame you for not immediately realizing that [substitute](https://nix.dev/manual/nix/2.26/glossary#gloss-substitute) roughly means “download from a cache” in Nix land.

---

_[View the full topic](https://discourse.nixos.org/t/i-o-cpu-scheduling-jobs-cores-and-performance-baby/66120)._
