Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 5 Feb 2003 15:24:05 -0800 (PST)
From:      Julian Elischer <julian@elischer.org>
To:        Peter Marrinon <peterm@telstra.net>
Cc:        freebsd-smp@freebsd.org
Subject:   Re: How is hyperthreading implemented?
Message-ID:  <Pine.BSF.4.21.0302051517530.97117-100000@InterJet.elischer.org>
In-Reply-To: <001301c2cd69$d23fc550$15008590@GALAXY>

next in thread | previous in thread | raw e-mail | index | archive | help


On Thu, 6 Feb 2003, Peter Marrinon wrote:

> I have a couple of questions about how hyperthreading works within FreeBSD:
> 
> 1) Is hyperthreading always a good thing? For instance, I have a CPU-hogging
> program that runs as a single process. When I run it on a dual CPU box with
> hyperthreading, according to 'top', the process is on one of the 4 virtual
> CPU's running at 99% while the other three CPU's sit back twiddling their
> thumbs. That indicates that the process is using 49.5% of a physical CPU. Is
> that what is really happening or is 'top' too high up in the OS to know
> about hyperthreading? What I hope is happening is that my process is
> actually using most of the cycles on one of the physical CPU's. Is that
> correct?

Think of each pair of CPU cores as sharing a few bottlenecks.
thus if you have one of them using the bottlenecks the other can't get
as much done as it could if it were a fully separate CPU.
Never-the-less it is still an advantage, becasue every now and then, one
of the CPUs stalls or does a FP operation or something that allows the 
alternate to get a few cycles in. If however you have 2 of these
chips,. each with 2 cores, then if you only have 2 threads running it
can be a problem..
imaging that you schedule thread 1 on Chip1, core1
now teh other thread has a 1/3 probability of being scheduledonto chip1,
core2, which would be a bad thing becuae it could get a lot more done if
it were on either of the other 2 cores. I do not believe that FreeBSD
has yet added code to try force such a job to another chip.
if you have 3 or 4 threads, you are ahead again.








> 
> 2) Does the scheduler know about hyperthreading? When running two CPU hungry
> programs I often see the processes on CPU0 and CPU1 with CPU2 and CPU3 being
> idle. Now as CPU0 and CPU1 are the same physical CPU, would it not be better
> that one of the two processes is running on CPU2 or CPU3 - or have I missed
> the point somewhere?
> 
> 3) [Off-topic] What is the second T in HTT for?
> 
> 
> Regards,
> 
> Peter
> 
> 
> 
> ---------------------------------------------------------------
> Peter Marrinon
> Systems Engineer
> Internet Development
> Global IP Networks
> Telstra
> 
> +61 2 6208 1684
> peterm@telstra.net
> 
> 
> 
> To Unsubscribe: send mail to majordomo@FreeBSD.org
> with "unsubscribe freebsd-smp" in the body of the message
> 


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-smp" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0302051517530.97117-100000>