two instances of a.exe on dual processor - still only 50% performance

James Chaldecott james@swythan.co.uk
Wed Jul 7 18:10:00 GMT 2004


mathias.wagner@philips.com wrote:
> Many thanks for this tip. I tried it out and indeed there is a "Set 
> Affinity" option in the Taskmanager. Apparently, this option lets you 
> assign one or more of the 4 virtual processors to a particular task. (W2K 
> seems to have this concept of virtual processors, I am no expert at all 
> here). But it doesn't change a thing. still 50% are spent on Idle mode... 
> :(

IIUC, I think you've come across how Intel's "HyperThreading" (HT) 
presents itself to the OS, and how Windows copes with it. This is not a 
Cygwin problem.

Basically all (?) new P4's come with HT. HT presents each physical CPU 
to the system as two "virtual" CPU's. The idea is that two threads can 
run simultaneously on the same CPU core, as long as they are not using 
the same parts of that core (e.g. one is on is doing floating point, one 
is doing integer).

Theoretically this should increase CPU throughput as well as providing 
some of the normal SMP benefits (e.g. system doesn't lock up under heavy 
load).

Uunfortunately, Windows doesn't (yet?) know that virtual CPU's aren't 
the same as physical CPU's. THis means a system with one HT enabled CPU 
appears to have two, and one with two physical CPU's (like yours) 
appears to have four. This means that a workload that would be 100% on a 
non-HT system is displayed as 50% on an HT system. You only ever get 
above 50% if HT is actually improving the situation *right now* and you 
are getting more throughput than you would without HT.

In my experience (I've got a single HT P4), the CPU load sometimes goes 
up to the mid 50's but the only thing I've seen saturate it to 100% is 
VirtualPC. Must be something about their emulation layer.

If your program is doing the same sort of operations throughout (e.g. 
long running loop of integer math) then I doubt you'll get it above 50%.

I would guess writing code to take advantage of HT is quite difficult 
but if you have integer & fp math interspersed, I suppose it might be 
worth running 4 copies and setting the affinity of each to a different 
virtual CPU. Hopefully the threads will get "out of step" and execute 
concurrently.

HTH,

James


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list