Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have a multi-threaded C++ app (using pThreads) that processes a massive flat file that works great on Windows - uses all four cores on my puny CPU. Client wants to run the same code on Red Hat on a fire-breathing 64 Xeon CPU machine. So I compile it here (g++), ran it on Ubuntu on VMWare, and code only used one of the four cores. So I'm thinking that is a VMWare problem, and I send code to client - where it does the same thing (as far as I can tell remotely - mpstat -P ALL shows the CPUs barely loaded). Do I need to do something to force Red Hat to spread out the threads? Is there something I'm missing - I'm trying to get the "nice" priority changed next - but I feel like I'm missing something.

I can post code - but like I said, works great on Windows, uses pThreads, etc.

share|improve this question
    
Get/Set CPU affinity –  Prince John Wesley Jun 29 '11 at 6:42
    
If mpstat shows that all CPUs are "barely loaded", then it seems that your program is not doing anything at all, not even on one CPU. Maybe you have a bottleneck in the I/O code? (Look for high values in the "%iowait" column in mpstat output.) Does the application behavior and the system load change if you increase/decrease the number of threads in your application? –  Riccardo Murri Jun 29 '11 at 8:01
    
Is the xeon also running VMware? is it a virtual machine? –  Keith Jun 29 '11 at 9:01

1 Answer 1

I would try to diagnose if this is a problem with your VM environment or your code. Here are some things to consider about your VM.

  • Do you have vmware configured to allow access to multiple CPU's? I don't have experience with recent versions, but it used to be something you had to specifically allow. In VirtualBox, I have an option in the virtual machine configuration that states how many CPU's the guest is allowed to work with.

  • If you cat /proc/cpuinfo from your Ubuntu guest do you see more than one CPU?

  • Do you get proper use of multiple CPU's if you do something generic like going into your kernel source an running a kernel compile with make -j10?

If any of these things turn up wrong, they would indicate your VM is misconfigured rather than there being a problem with your code.

share|improve this answer

Your Answer

 
discard

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.