delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2004/07/07/14:10:37

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
To: cygwin AT cygwin DOT com
From: James Chaldecott <james AT swythan DOT co DOT uk>
Subject: Re: two instances of a.exe on dual processor - still only 50% performance
Date: Wed, 07 Jul 2004 11:11:15 +0100
Lines: 46
Message-ID: <ccgi84$pbg$1@sea.gmane.org>
References: <OF350E233D DOT 3A8C27A7-ONC1256ECA DOT 0027FEFC-C1256ECA DOT 00282CE1 AT philips DOT com>
Mime-Version: 1.0
X-Complaints-To: usenet AT sea DOT gmane DOT org
X-Gmane-NNTP-Posting-Host: phantom.oxinst.co.uk
User-Agent: Mozilla Thunderbird 0.7 (Windows/20040616)
In-Reply-To: <OF350E233D.3A8C27A7-ONC1256ECA.0027FEFC-C1256ECA.00282CE1@philips.com>

mathias DOT wagner AT philips DOT 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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019