help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Will using make -j actually use multiple processor cores?


From: Paul Smith
Subject: Re: Will using make -j actually use multiple processor cores?
Date: Tue, 04 Nov 2014 08:54:27 -0500

On Tue, 2014-11-04 at 14:23 +0530, Shriramana Sharma wrote:
> Hello. I learnt that I can use make -j to have make execute multiple
> jobs in parallel. Does this somehow guarantee that my 4 cores of an i5
> will be used simultaneously or is that left to the (Linux) kernel?

It means that instead of running one instance of your compiler (or
whatever command) at a time, make will run more than one at a time.

So if make would run these commands:

   cc -o foo.o -c foo.c
   cc -o bar.o -c bar.c
   cc -o baz.o -c baz.c

(run one, wait for it to exit, run the next), make -j3 will run the
shell equivalent of:

   cc -o foo.o -c foo.c &
   cc -o bar.o -c bar.c &
   cc -o baz.o -c baz.c &
 
then wait for them to complete.  As each one completes make will start
another command, until all of them are done.

It's up to the operating system to schedule how these processes should
be run, based on your hardware, other processes running on the system,
etc.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]