# Intel Hyper-Threading & FreeBSD



## Graaf_van_Vlaanderen (Mar 2, 2009)

I read some articles how this can affect security. How does it affect performance in FreeBSD? What are your experiences/recommendations? Which (kind of) applications do benefit from hyper-threading?


----------



## mk (Mar 2, 2009)

you can check this as a start.


----------



## Graaf_van_Vlaanderen (Mar 2, 2009)

Thanks for the link.
I did some tests on my own on a DL360 G4 single 3.4GHz CPU
(1MB L2 cache) and have the impression that it's better to switch off hyper-threading for applications like Octave, which invokes Gnuplot while executing the script.
Also 'unixbench' gives better results, with hyper-threading disabled.


----------



## hydra (Mar 2, 2009)

My former computer with P4 provided much worse results in Quake3 when HT was enabled. The idea behind HT may be nice, but the reality seems to be somewhere else...


----------



## Anonymous (Mar 3, 2009)

I have a CPU: Intel(R) Pentium(R) 4 CPU 2.60GHz (2605.92-MHz 686-class CPU) and with HT enable it is faster and when I compailing for example I can working with GIMP, OO without problem.


----------



## mk (Mar 3, 2009)

AFAIK HT in newest intel cpu is  redesign from scratch i.e P4 HT can't be compare with i7 (that's how my small research end but i didn't manage to get some specs of what exactly is HT from intel site, yes there is wikipedia but ...


----------



## hydra (Mar 3, 2009)

@lumiwa
How did you notice it's faster ? In what sort of applications ?

@mk
HT splits a single core into 2 virtual CPUs, so the OS scheduler believes there are two processors. If two operations use disjoint function blocks, they can be executed in parallel. There are some security considerations since they both use the same cache. This is made obsolete by Core 2 Duo and others, where you don't pretend to have a multitude of function blocks, but you really have more cores.


----------



## Graaf_van_Vlaanderen (Mar 4, 2009)

[align=left][align=center][align=right][align=center][align=left][align=center]Here are some results from unixbench on a DL360 G4 with a Xeon 3.4GHz (1MB L2):

I: Hyper-threading enabled:

                     INDEX VALUES            
TEST                                        BASELINE     RESULT      INDEX

Dhrystone 2 using register variables        116700.0  9784314.6      838.4
Double-Precision Whetstone                      55.0     1874.8      340.9
Execl Throughput                                43.0     1322.2      307.5
File Copy 1024 bufsize 2000 maxblocks         3960.0    31338.0       79.1
File Copy 256 bufsize 500 maxblocks           1655.0    32655.0      197.3
File Copy 4096 bufsize 8000 maxblocks         5800.0    32812.0       56.6
Pipe Throughput                              12440.0   621656.8      499.7
Pipe-based Context Switching                  4000.0    93648.1      234.1
Process Creation                               126.0     4380.0      347.6
Shell Scripts (8 concurrent)                     6.0      326.3      543.8
System Call Overhead                         15000.0   537310.4      358.2
                                                                 =========
     FINAL SCORE                                                     272.5



II: Hyper-threading disabled:

TEST                                        BASELINE     RESULT      INDEX

Dhrystone 2 using register variables        116700.0  9808714.4      840.5
Double-Precision Whetstone                      55.0     1876.3      341.1
Execl Throughput                                43.0     1366.9      317.9
File Copy 1024 bufsize 2000 maxblocks         3960.0    26512.0       66.9
File Copy 256 bufsize 500 maxblocks           1655.0    27417.0      165.7
File Copy 4096 bufsize 8000 maxblocks         5800.0    32259.0       55.6
Pipe Throughput                              12440.0   621646.8      499.7
Pipe-based Context Switching                  4000.0   128596.4      321.5
Process Creation                               126.0     5117.5      406.2
Shell Scripts (8 concurrent)                     6.0      395.0      658.3
System Call Overhead                         15000.0   540504.8      360.3
                                                                 =========
     FINAL SCORE                                                     281.2[align=center]​[/align][/align][/align][/align][/align]​[/align][/align]


----------



## Carpetsmoker (Mar 4, 2009)

HyperThreading should preform better when you have multiple applications running, in a typical Windows environment you often have quite a bit of stuff running in the background, and HT should really help in those cases -- At least, this is what our Intel rep told me during the i7 briefing.


----------



## Mel_Flynn (Mar 4, 2009)

Hmm, interesting results. Concurrent shellscripts and pipe-based context switching is expected to be slower, but I didn't expect the file copies to be significantly faster. Did you reboot and give machine cooldown time before starting the second test?


----------



## phoenix (Mar 4, 2009)

Carpetsmoker said:
			
		

> HyperThreading should preform better when you have multiple applications running, in a typical Windows environment you often have quite a bit of stuff running in the background, and HT should really help in those cases -- At least, this is what our Intel rep told me during the i7 briefing.



HyperThreading on P4/Core/Core2 CPUs is very different from HyperThreading on i7 CPUs.

The usefulness of HTT on P4/Core/Core2 is very hit-and-miss.  Some workloads benefit, some don't.  The main reason is that the way the CPU units are split is not uniform, and if you don't have an HTT-aware CPU scheduler (ie one that things both logical CPUs are identical) you can severely hamper performance.

Supposedly, HTT on i7 is smarter, and the CPU can properly balance instructions across the logical CPUs.  In theory, HTT on i7 should be useable for all workloads.


----------



## Graaf_van_Vlaanderen (Mar 4, 2009)

I did one of the tests yesterday and the other (disabled) today. In both cases the machine was running already for about an
hour and no other programs were running during this test.
Some extra info. Both hard disks (one of them is new!) are in RAID1 and the used memory is DDR (PC2700).

I remember about 5 years ago when moving from Solaris 8 to Red Hat for Cadence design tools, on all the simulation servers hyper-threading was enabled. At that time we didn't have a MP simulator available. So if you were the only one running a long simulation of twelve hours on a dual (P4 like) Xeon machine you had the impression that only 25 percent of this machine was used.


----------



## Anonymous (Mar 5, 2009)

hydra said:
			
		

> @lumiwa
> How did you notice it's faster ? In what sort of applications ?



Example: postmaster -a. There are 5 app for update and it start. Than I start KDE, Gimp and working with pictures and with Amarok listen music and use Opera for surfing. Everything run smooth but if I do same with HT disabled than I have problem with music, waiting for Gimp, surfing...and OO running too.

I didn't ran any benchamrk just my personal opinion (feeling  )
I did try with HT disabled about one week just for test and than went back to HT enabled.


----------



## estrabd (Jan 30, 2012)

I know this is an old thread, but I am doing research on HT and FreeBSD - because I am looking at setting up a Xeon-based system (Dell PowerEdge 1750) with HT support. HT really just interleaves memory fetches with instructions between two logical threads of execution - as said above, benefits are greatly dependent on the workload.


----------

