I am trying to determine when I should disable HT in my P4 CPU.
The way I understand it is that with Hyperthread (HT) enabled, the Windows task manager will show only 50% CPU utilisation for a single threaded application when in fact it is probably 99%. This is because unlike a true dual-core processor, a HT processor is essentially a single CPU masking as 2 CPU to the OS, with the exception that if a new thread is created, the HT CPU can inject the new instruction into an already running process. But the new thread actually processed by the same CPU core.
In a non HT CPU, that new thread has to wait for the first thread to finish before it is allowed to start.
Now here comes the questions:
1. I've heard forums saying HT actually slows down some applications, but no examples given. Does anyone know exactly which kind of applications are better off with HT disabled? Games? Office? Multimedia compression/decompression?
2. I'm tried running a pattern-matching program (single thread) that will take a long time to run. Would I be better off with the HT disabled?
3. If I had a dual-core CPU, the 2nd coe would basically be wasted in case #2 because core #2 will just sit and do nothing right? Thus a dual-core CPU running at 2.8GHz will actually not gain any performance over the 1-core CPU?
When running your application on Windows the processor is burdened by not only your application but also by overhead by Windows. Although the overhead might not seem like much it does add up. If your system is not doing anything else (no analysis of partial data from your application, no email, no internetbrowsing, no music, no Solitare, etc...) then there will be no advantage of going to dual core. Under these circumstances you can experiment with HT on and off to see the performance effect on your application.
If you are doing low processing activity e.g. periodic peek at application progress and occasional email or internet browsingthen HT would likely benifit your needs.
Your application is likely writing progress data to the disk. Consider turning off Anti-Virus (assuming you are not browsing the internet or reading email).
If your other needs are low processing activity but interact with screen updates then you may find the best return on investment is to install a low end video card which meets your needs and disable the motherboard integrated video.
You would be surprised how much overhead a motherboard integrated video imposes on the system. I ran a test to measure this.
The test system was a 2 x AMD Opteron 270 server (each processor has 2 cores). i.e.4 core system.
The mother board was a Tyan Thunder K8SR with integrated video.
The simplified test was console window batch file
dir c: /s/b
The batch file uses some disk I/O and a high volume of text output to a Console Window (not full screen). Processing time to format text should be relatively low.
The measurement tool was the Windows Task Manager Performance window. (not scientific but adiquite for approximation)
Running the test using the integrated video showed 25% CPU utilization and the charts showed nearly 100% on one of the 4 CPUs (one core).
Installing a low end video card (NVida GeForce4 MX4000) and turning off the integrated video (this is done by jumper J85 on the K8SR motherboard).
Running the same test, the display painted muchfaster and the Task Manager could hardly measure the CPU overhead. i.e. bliping between 0% and 1%.
The video card was about $50 or so - a good return on investment.
Your experience may vary from mine.
Enabling HT is more likely to hurt performance on a dual core or dual socket machine, due to scheduler problems in Windows or older linux versions. If you are running 2 threads, you want them on separate cores or (preferably) separate sockets, since the 2nd HT logical processor on a core has only a few of the resources of a separate core. In the case you brought up, if there is only 1 thread, it should not lose much performance by jumping back and forth between 2 logical processors on the same core. There may be a few extra L1 cache misses when the thread moves.
There could be some additional loss if it moves between cores which have separate L2 (as on Pentium-D). So it is conceivable that a Pentium-D might perform a little better as a single core with the 2nd core disabled. I don't believe that's the primary reason for supplying an option to disable a core. If you have drivers or programs which are incorrectly threaded, which was often done on Windows 9x, disabling the 2nd core might "fix" them.
In linux, there are utilities such as taskset which could be used to reduce undesirable movement of a thread, without requiring changes to the application or kernel upgrade. In Windows, you could use Task Manager to set affinity of a running thread, to lock it to a core.
Evidently, we would prefer to see these possible issues corrected rather than ask you to disable a core or require the use of affinity tools.
Thanks very much. I found an excellent article explaining this:
For my case of a long running single-threaded process, I found HT being very good in making my PC (P4 2.8C single CPU) very usable eventhough there's a process that sucks up 100% of the CPU.
I was surfing and doing DVD burning with the pattern-matching program in the background but didn't notice any slow down in the GUI because whenever my interactive inputs are made, the execution goes to the 2nd logical CPU. In this way, the CPU is used up most efficiently. The pattern-matching program has a small memory footprint, and doesn't use the HDD when working.
It seems from the article above that HT slows down processes that require a lot of memory becauseof cache conflicts. In particular, DIVx encoding was bad, butgenerally HTboosted performance. I don't know about 3D games like Half Life 2 or C&C Generals though, as there doesn't seem to be any experiments out there on this.