2

I'm using BuildRoot to build root filesystem images, from within VirtualBox. The builds are very slow.

Is there any advantage to running "make -j2" in the virtual machine? The /proc/cpuinfo from within the virtual machine is:

smachin@smachin-ubuntu:~/neo-build/rfs$ cat /proc/cpuinfo
processor   : 0
vendor_id   : GenuineIntel
cpu family  : 6
model       : 58
model name  : Intel(R) Core(TM) i7-3687U CPU @ 2.10GHz
stepping    : 9
microcode   : 0x19
cpu MHz     : 2594.218
cache size  : 6144 KB
physical id : 0
siblings    : 1
core id     : 0
cpu cores   : 1
apicid      : 0
initial apicid  : 0
fpu     : yes
fpu_exception   : yes
cpuid level : 5
wp      : yes
flags       : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 syscall nx rdtscp lm constant_tsc rep_good nopl pni monitor ssse3 lahf_lm
bogomips    : 5188.43
clflush size    : 64
cache_alignment : 64
address sizes   : 36 bits physical, 48 bits virtual
power management:
  • 1
    Why not just try make -j2? (Even though you've only configured one virtual CPU, if anything is I/O bound in the build process -j2 could make the overall build faster.) – Stephen Kitt Jul 18 '15 at 15:31
5

Yes, there can be. If the system is I/O bound and CPU bound, -j2 will get more CPU being used while the other process is doing disk I/O. However, increasing the number of processes requesting from the disk could make it slower due to contention for disk head movement.

As Stephen Kitt said, test it.

time make clean all
time make -j 2 clean all
time make -j 3 clean all

You are in VirtualBox. Assuming you own the machine, you can shut down the VM, increase the number of CPU cores, boot, run your builds and shut back down to drop it back to 1 core.

Alternatively, you could just leave it at 2 cores. Linux is very efficient. Just because you give two cores to the VM does not make them unavailable for the host OS. If the guest OS isn't doing anything, those cores are available to the host.

  • I can attest to the followinmg rule of thumb on a working Gentoo Box the Rule of thumb states "A good choice is the number of CPUs (or CPU cores) in the system plus one, but this guideline isn't always perfect.". As such, I would assume that holds true for Virtual Machines as well.. – eyoung100 Jul 18 '15 at 18:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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