Intel Hyperthreading & multiple CPU intensive tasks

icarus4586

Senior member
Jun 10, 2004
219
0
0
I've got a question regarding Hyperthreading and task scheduling for 2 CPU intensive tasks. Let's say you've got 1 HT-enabled CPU, and one of the tasks has a higher priority than the other. Without HT, the lower priority one would very rarely be allowed to run, since almost all of the free cycles should be going to the process with a higher priority. However, since a HT-enabled CPU causes the OS to think it has two CPUs to work with, it could schedule all the high-priority interactive jobs and the lower-priority CPU bound job on one "CPU," and the higher-priority CPU-bound job on the other "CPU." (I realize this is a simplification, but it does approximate what could happen.) Since there's really only 1 CPU, could this effectively cause the lower-priority job to preempt the higher-priority one, causing it not to get scheduled on the one real CPU as often?

(edited for spelling)
 

borealiss

Senior member
Jun 23, 2000
913
0
0
theoretically if you had 2 logical processors and the OS scheduler had a process per logical proc than you would see them share the same cpu resources 50/50. let's assume that the processes use the same working set of code, just executing at different OS-level priorities.

one of the unfortunate side effects of having hyperthreading is that there is no thread priority feedback mechanism to tell the hardware which has higher priority, assuming same hardware privilege levels for both processes. if the operating system could distinguish between 2 physical procs and 2 logical procs than perhaps it could throttle the lower priority process so that the other process could have more time on hardware. it's a conundrum.
 

Peter

Elite Member
Oct 15, 1999
9,640
1
0
Recent OSes are HyperThreading-aware, meaning that they /know/ they do not actually have two processors. This influences the affinity strategy.
 

Peter

Elite Member
Oct 15, 1999
9,640
1
0
The CPU can be identified as an HT pseudo-dual from its responses to CPUID, yes.