do threads automatcally get assigned to cores before hyperthreading?

jondeker

Junior Member
May 30, 2010
18
0
0
If you have a hyperthreading cpu with 2 cores, 4 threads, and then run an app that generates 2 threads, how will the threads be assigned?

Since the OS sees 4 separate cpu's, is it possible that only 1 core will get both threads from the app?
 

Mr. Pedantic

Diamond Member
Feb 14, 2010
5,027
0
76
randomly. Yes, it is possible that 1 core will get both threads, and in that case, if you're running nothing else, performance will suffer slightly (or not so slightly, depending on what it is). This is why a lot of people say to turn off HT for gaming, because Windows will assign threads randomly and if you get 2 threads on the same core you'll get lower performance.
 

Munky

Diamond Member
Feb 5, 2005
9,372
0
76
It depends on the OS. Windows 7, for example, knows the difference between physical and logical cores, and will prioritize threads to physical cores. Windows XP, on the other hand... doesn't seem to know the difference.
 

Cogman

Lifer
Sep 19, 2000
10,284
138
106
As munky said, it depends. The CPU does provide the capabilities to tell if a core is physical or logical (IE hyperthreading core). It is up to the OS to decide to use that information and to schedule threads on said CPU.

How the OS decides to assign tasks is up to the OS, not the CPU. And since the OS is in charge, the assigning will vary from OS to OS.
 
Dec 30, 2004
12,553
2
76
A while ago WoW locked it to the first 2 threads. Which was hilarious, because $100 dual core AMD systems were outperforming 4Ghz core i7 systems. And then the Blizzard forum employees had the nerve to be all like 'Oh and there's a nice bonus too with the intel systems, TURBOBOOST!!' marketing? or something for Intel. That was weird.
 

iCyborg

Golden Member
Aug 8, 2008
1,344
61
91
A while ago WoW locked it to the first 2 threads.
I assume you mean first two logical processors, not threads...

In newer Win versions you can assign CPU affinities yourself to any process from task manager, and this can also be done programatically by developers. But in both cases it should really be left to the OS scheduler, they keep track of other things to optimize what is executed on which CPU.
 

Voo

Golden Member
Feb 27, 2009
1,684
0
76
But in both cases it should really be left to the OS scheduler, they keep track of other things to optimize what is executed on which CPU.
Amen. No idea why some developers think they should play with stuff like that, especially if they don't even do it right (Wow's the perfect example..) and all modern OSes handle logical cores in a sensible manner (ahm that is Win7 and modern Linux kernels, I wager Mac OS does not)

But at least in WoW you can fix it easily with the config file..
 

aigomorla

CPU, Cases&Cooling Mod PC Gaming Mod Elite Member
Super Moderator
Sep 28, 2005
21,054
3,545
126
Isnt parallelism written into the program more related to work distributed on logical cores then the OS itself?
 

punker

Member
Oct 24, 2007
121
0
0
randomly. Yes, it is possible that 1 core will get both threads, and in that case, if you're running nothing else, performance will suffer slightly (or not so slightly, depending on what it is). This is why a lot of people say to turn off HT for gaming, because Windows will assign threads randomly and if you get 2 threads on the same core you'll get lower performance.

wrong!

if you manually assign threads you can still get better performance(it does save at lest for me in windows 7))



you should see how it handles 8 Physical cores its quite interesting

when each thread changes each cpu core
 
Last edited:

aigomorla

CPU, Cases&Cooling Mod PC Gaming Mod Elite Member
Super Moderator
Sep 28, 2005
21,054
3,545
126
you should see how it handles 8 Physical cores its quite interesting

when each thread changes each cpu core

actually as you get on the higher tier platforms... and jump into intel hexcores and 12 core systems.. i heard they shut down inactive cores. :sneaky:


http://www.hardwarecanucks.com/foru...ulftown-six-core-32nm-processor-review-5.html
"for example, if you are using a single-threaded application, the PCU will down-clock or shut down the unused cores, thereby freeing up power and lowering heat output while "overclocking" that one core that is in use."

BTW i own a hexcore system and a octocore DP system.