I have a multithreaded app that I would expect ought to benefit from turning hyperthreading on.
But instead performance is little better (within 3%) when using all logical cpus versus not enabling hyperthreading (e.g. 8 logical versus 4 physical).
When comparing performance of my app with x logical CPUs versus with x physical CPUs performance is actually 40% lower when using hyperthreading.
I know about using Windows APIs to control which CPUs which threads can run on but I was hoping for a FAQ or developers guide to making an app hyperthread aware.
Our customers cant understand why we cant do better.
Is there a dummies list of things to avoid and things that need to be done when reviewing your own code?
I do have some threads that are memory intensive and others at times CPU intensive - can I use hyperthreading to leverage this distinction?
One of the common confusions about Hyper-Threading is that thisit creates a"logical" processor, not multiple physical processors. As such, threads often share resources within the processor. Threads are scheduled to execute when operations of another thread do not make full utilization of processing units. Thus, while one thread is performing a memory operation, a second thread can be scheduled to perform an arithmetic operation.
Adding threads to an application does not guarantee improved performance with Hyper-Threading. If the application is highly optimized and there are few unused processing units at any time, there will be little room for a second thread to be run concurrently and the gain from HT will be minimal. In othercases, we have seen threaded applications that use different priority threads. Since the O/S believes 2 processors are active, a lower priority thread may be scheduled to run more often than it would on a single CPU system, and consequently, block execution of the main thread and lowering the overall performance.
One resource for advice and information would be the IDS Hyper-Threading page under Software Technologies:Threading (http://www.intel.com/cd/ids/developer/asmo-na/eng/technologies/threading/hyperthreading/index.htm). There are several articles on performance monitoring under Hyper-Threading. This might be a place to start looking for ideas about why you are not seeing your expected performance levels.-- clay