[CoLoCo] System Monitor/Dual CPU box

Ryan Maki ryan.maki at gmail.com
Wed Oct 31 02:27:29 GMT 2007

> On 10/30/07, Kenneth D Weinert <kenw at quarter-flash.com> wrote:
>> Is this normal behaviour?
>> I got the System Monitor app fired up and was watching the CPU usage.
>> With a dual cpu box I see one CPU running at 100% and the other  
>> idling
>> around 10-20% or whatever.

You are more than likely seeing plain old OS thread scheduling in  
action.  The task that you are performing is likely single-threaded  
and CPU intensive.  It's not real load balancing, it's actually a sign  
of a poorly threaded application (or one that cannot easily be  
parallelized.)  When the thread finishes and the next operation begins  
it starts on the other processor.  This is quite common these days.   
Hyperthreaded machines also exhibit this behaviour, but it's not quite  
so obvious.

>> Every now and then, without a discernible pattern (at least short  
>> term),
>> the two CPUs switch. The other goes to 100% and the one at 100% drop
>> down to the "background" level.

Often when you watch these applications on a CPU graph you will see a  
sine wave as one CPU usage goes up and the other goes down in lockstep  
with each other.

>> Just seemed odd to me, but I expect there's a good reason for it that
>> I've just not thought of yet.

Ideally the task your application is performing would be broken down  
into many smaller parts that could run concurrently and be more  
effectively scheduled.  In reality, it takes quite a lot of thought to  
break any given task into these smaller workloads.  As the number of  
cores in consumer desktops goes up, this problem will waste more and  
more CPU cycles until programmers re-orient their methods and get  
tools that support them.  Intel announced at their developer forum  
that they are working on a CPU with 80 (eight-zero) cores that is  
eventually intended for the desktop market.

If this interests you at all, there are programming languages which  
are expressly designed to parallelize, such as Erlang and Haskell.  If  
you poke around a bit their introductory web pages usually describe  
the problem in better detail than I could.

~ Ryan

More information about the Ubuntu-us-co mailing list