this post was submitted on 27 Nov 2023
8 points (100.0% liked)
Debian operating system
2724 readers
2 users here now
Debian is a free operating system (OS) for your computer. An operating system is the set of basic programs and utilities that make your computer run. Debian provides more than a pure OS: it comes with over 59000 packages, precompiled software bundled up in a nice format for easy installation on your machine.
founded 4 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
make -j
will create unlimited jobs. If you have very few CPU cores you will likely overload your CPU with tens or hundreds (or maybe even thousands) of compilation jobs.Each one of those jobs will need RAM. If you eat up all of your RAM then your computer will hit swap and become unusable for hours (at best) or days. I've had a computer chug along for weeks in swap like that before OOMkiller decided to do things. And the worst part is the Out-Of-Memory killer decided to kill all the wrong things...
The
-j
argument has an optional additional argument. The additional argument is the limit to the number of jobs. The best thing you can do is (roughly) usemake -j$(nproc)
. That will give the number of processors as an optional argument to-j
. If your build line gets parsed (as is common in an IDE) then you might replace "$(nproc)" with a hard number. So if you have 20 cores in your CPU then you might do -j20. If you only have 8GB of RAM with your 20 cores then maybe you give it -j8. I saw one guy try to get fancy with math to divide up CPU and RAM and ... it was just way more complicated to get at the same number as nproc :)I, personally, just buy more RAM. Then with my 20 cores and 64GB of RAM, there's plenty of headroom for compilation in the background for each one core and also room in RAM for a browser for documentation and IDE for all the editing. Developer machines are known for being resource hogs. Might as well lean in to that stereotype just a tiny bit.
And one tiny edit: I highly suggest you start to read the manual.
man make
will tell you all about how-j
works :) andman nproc
and there's tons of others too. I lovegit
's manual pages, they're pretty awesome.man make
tells: