Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to install LLVM on my CentOS machine. In the installation tutorial of LLVM, a flag -jn is specified along with make.

It says to perform make -jn and also says "Choose n such that make doesn’t run in to swap space issue."

What is the use of the -j flag and how can I choose the value of n?

share|improve this question
up vote 5 down vote accepted

The -j make flag denotes how many threads you want to allot for compiling.

n is, in this case, a place-holder for the number of processes.

The classic rule of thumb is that it's safe to make n = the number of cores your CPU has. So if you are on a dual core machine, you might use -j2, while on an 8-core machine -j8

In practise, I have found that to be a good starting place, but you should probably feel free to experiment a bit and see what works best for you.

share|improve this answer
I like cores + 1 – WorBlux Jan 24 at 23:32
Won't it be processes not threads in a strict sense? – heemayl Jan 25 at 1:27
yes good point @heemayl – Klaatu von Schlacker Jan 25 at 2:58
Cores+1 is usually a better option: it lets you have one process stalled on disk I/O while still fully utilizing your CPU. – Mark Jan 25 at 4:53

Whether it's safe to use n = number of cores also depends on whether you have enough memory for all the parallel compile/link jobs. It could also cause issues for disk I/O. If this is a make job you only expect to need to run once it's probably better to choose a lower n and just let it take its time.

share|improve this answer

The -j flag tells make(1) how many processes to run in parallel. Best value depends on the tasks run, dependencies, ... a rule of thumb is the number of processors. If you give just -j (no n), make starts as many processes in parallel as possible.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.