How do I make "zig build" run single threaded?

The compiler crash I’ve been hunting down is still present, so I need to lock things down. I’m slowly getting through the bootstrap phase, but it seems like I also need to figure out how to make “zig build” run single threaded.

Is there a flag or procedure to do this?


1 Like

-j1 perhaps?

  -j<N>                        Limit concurrent jobs (default is to use all CPU cores)

Ergh. </facepalm>


It’s always worth asking!

I think we could improve the description of the -j flag here. Instead of saying “concurrent” it could say “parallel” or “threads”

Also, only if it’s common enough, I think a --single-thread flag that’s the equivalent of j1 could be introduced

It isn’t always parallel – you may have 16 cores and you can still run your build with -j 128 – useless as that might be.


True, but you’d be running at least some in parallel (unless 15 cores were tied up with some other work)

The most common usage of “concurrent” in programming I’ve seen is that it actually implies something like suspendable/resumable, like the JS single-thread concurrency model, and not “being executed at the same time.”

I process concurrent as "interleaved and possibly in parallel. In other words, to me parallel always implies concurrent, but concurrent might imply parallel.

With one CPU core everything is “concurrent”, regardless either this managed by OS kernel scheduler (processes, threads) or by some app (with or without OS scheduler). With number of CPU cores N > 1 you can have at maximum N tasks running in parallel, each of these tasks can do their subtasks concurrently (interleaving, alternately), but do not forget about i/o devices - you can have 128+ super modern CPU cores and one 10 Mbit ethernet card :slight_smile: and what?