Search code examples
multithreadingmulticore

Multi core CPU single thread behaviour, not achieving 100%


alt text

As you can see from the attached image the CPU graph on my dual core machine is weirdly symmetrical!

Is this some sort of load balancing to prevent one core being used more than the other? What are the reasons behind it (heat distribution maybe)?

Of course my main concern: is my single thread PSNR image algorithm achieving 100%?

CPU is Core 2 Duo E6850 3Ghz running Ubuntu 10.4.

Thanks

Ross


Solution

  • You are achieving a 50% load using both CPUs. Your program is not attached to a fixed CPU so it's switching, depending on the kernel (and other processes running on your system).

    If you want to be sure your process is running on one of your cores, you have to set affinity (Example here). This way, you should see a 100% load on one core, the other one being used for other tasks.