• Welcome to TechPowerUp Forums, Guest! Please check out our forum guidelines for info related to our community.
  • The forums have been upgraded with support for dark mode. By default it will follow the setting on your system/browser. You may override it by scrolling to the end of the page and clicking the gears icon.

Cores first or threads?

Joined
Sep 27, 2016
Messages
106 (0.03/day)
Processor Ryzen 5 5600X
Motherboard Asrock B550M Pro4
Cooling Cooler Master 212 EVO Black
Memory 32GB Corsair Vengance XPL
Video Card(s) Sapphire Pulse RX 7800 XT 16GB
Storage 1TB PCIe Gen 4 SSD
Display(s) 32" LG
Case Cooler Master HAF 912 (legacy)
Audio Device(s) Altec Lansing 3-way (legacy)
Power Supply 850W XFX Black Edition
Mouse Logitech
Keyboard Logitech
Software Win11 Home 64bit
I hope I am able to ask my question so it is understandable, and that it makes any sense.
When an executable program runs and needs to start another thread, does it first utilize a core's Hyper-Threading (Simultaneous Multi-Threading for AMD) capability for that thread... or does it utilize the next real core? In otherwords, are all the real cores used first?
 
AFAIK, the OS decides this. If it is setup properly then it will use the next open core before using the 2nd thread on cores. This is why Windows identifies most of the Bulldozer based processors as 1c/2t per module instead of 2c. Because even though each module had 2 cores in it, they shared the FPU, so the second core can be much slower if both are trying to do heavy FPU work.
 
I hope I am able to ask my question so it is understandable, and that it makes any sense.
When an executable program runs and needs to start another thread, does it first utilize a core's Hyper-Threading (Simultaneous Multi-Threading for AMD) capability for that thread... or does it utilize the next real core? In otherwords, are all the real cores used first?

This seems like a simplified version of a more specific question you really want to ask.
 
This seems like a simplified version of a more specific question you really want to ask.
Not really. I'm a pretty simple person :)

AFAIK, the OS decides this. If it is setup properly then it will use the next open core before using the 2nd thread on cores. This is why Windows identifies most of the Bulldozer based processors as 1c/2t per module instead of 2c. Because even though each module had 2 cores in it, they shared the FPU, so the second core can be much slower if both are trying to do heavy FPU work.
So, take a Windows game for instance... would the OS still determine that over the game's engine?
Btw, I think either way, your OS answer seems logical.
 
I am not too savvy when it comes to things like this but my thought process is that Windows sees cores and threads the same for AM4 CPUs, In WIndows you will see all logical processors if you change the view. The best way to determine what you want would be to run a application WIndowed and have task manager (performance tab) show what is being utilized. You may not be able to differentiate between what is a real core or not though.
 
I think newtekie1 is right but I think there is much more involved. Windows is NEVER doing just one task. It is networking, managing virtual memory, running security, sending video to the graphics solution, waiting/processing input from all sorts of I/O devices and much more. So it is going to utilize CPU resources as it sees fit at that point in time.
 
Newtekie is correct. Programs don't get to determine that, the OS does. And windows at least has a pretty complicated method of determining what to use, such that you aren't likely to be able to predict it. (Unless of course, you set processor affinity to override that.) Regardless, it's all abstracted away from the program. The program asks for a thread, and the OS gives it one. The program doesn't know or usually care what it's running on.
 
So, take a Windows game for instance... would the OS still determine that over the game's engine?
Btw, I think either way, your OS answer seems logical.

Is there a specific windows game that you feel is not properly utilizing the SMT on your 1600x?

Newtekie is correct. Programs don't get to determine that, the OS does. And windows at least has a pretty complicated method of determining what to use, such that you aren't likely to be able to predict it. (Unless of course, you set processor affinity to override that.) Regardless, it's all abstracted away from the program. The program asks for a thread, and the OS gives it one. The program doesn't know or usually care what it's running on.

I'm not a programmer so this is a question; Can you set up the application through an API not to use multi-threading? Maybe the programmer feels multiple threads sharing resources can cause a conflict or something along those lines?
 
I'm not a programmer so this is a question; Can you set up the application through an API not to use multi-threading? Maybe the programmer feels multiple threads sharing resources can cause a conflict or something along those lines?

If your program runs a single thread, it will not use multithreading, yes.

Perhaps it might help to tell us what you're trying to do. Since you're not a programmer, I assume you want to make a specific program run on real cores. If that's the case, set processor affinity.
 
AFAIR, per amd the os decides that(and why some MS update stuff helped with 3xxx perf),
but if possible, the cpu usually will prefer running a single thread per core.
 
Perhaps it might help to tell us what you're trying to do. Since you're not a programmer, I assume you want to make a specific program run on real cores. If that's the case, set processor affinity.

Not trying to do anything just wondering if a programmer would be able to over ride the OS through API. Appreciate the response.
 
Not trying to do anything just wondering if a programmer would be able to over ride the OS through API. Appreciate the response.

An executable program can create threads all day long, but there isn't any way I'm aware of for the program to internally tell the OS where to put them. The program generally does not know anything about CPU cores. That's handled in the OS kernel. The program is going to tell windows "create me a thread" and the OS kernel is going to start that thread on a CPU core (real or virtual, according to its own rules) and then tell the program "Here's your thread." The program knows nothing about the CPU really.
(note, this is limited to windows and other desktop computer OS's. There are exceptions, embedded applications, etc, but that's just going to confuse the topic.)

EDIT: Totally thought I was talking to the OP, and was asking what he was trying to do. Sorry for the confusion lol.
 
core affinity works, just didnt see any gains on 1909 with matching drivers/bios.
especially since it involved a bit of "work", and your running another prog,
so i would only do it that way if you dont want 1903/1909 build.

Process Lasso
 
Is there a specific windows game that you feel is not properly utilizing the SMT on your 1600x?
No. It is just something I've always been curious about and thought I'd ask folks here who might know the answer.
Btw, thanks for reminding me about that old 'system specs' I still have under my name. I have to change that before I forget again.
 
What can you make out of this...
Look the first large section. T0 are the physical cores and T1 are the logical ones.
Cores 1/2/3 are the higher quality(faster), and cores 0/4/5 are the lowest.
Average column of "Eff clock" or "Thread-usage" is the ones to track. This is 7+hours of idling and low loads (browsing and video).

I'm using @1usmus v1.1 power plan that differenciate loading between cores from other power plans (Win default or Ryzen speced). Its trying to keep loads on high quality cores but trying also to keep loads in 1 CCX first for low latency, if possible.

C0 residency is active core state
C1 residency is sleeping core state
C6 residency is deep sleeping core state
...again average column makes sense to see and study

1580938917736.png


If you want to see more or anything different just tell me or you can monitor yours the same way.

Oh and this is 2+ hours gaming (FarCry5)

HWiNFO_18_01_2020_FarCry5.png
 
Last edited:
Not trying to do anything just wondering if a programmer would be able to over ride the OS through API. Appreciate the response.
Yes, you can program proc affinity. In fact the game "Escape from Tarkov" does this by limiting itself to the physical cores. Although it doesn't work very well in that you need to keep reapplying the setting to get it to stick, it is there.
 
Don't some boards' BIOSs allow disabling Hyper Threading? Or in the case of Ryzen; SMT? (I'm not on my MSI Z390-A Pro right now to check) I'm on an aging Asus M9A99X EVO at present.
 
@Zach_01
unless you have "proof" (as in you have seen it yourself), 1usmus does NOT change nor improve core/ccx handling (better than OS),
not possible with a power plan (but has been misleadingly reported as such).
major reason why i recommend using his plan only if the cpu doesnt perform as expected (clocks).

looking at what ppl with a lot more knowledge about this (hw/sw) posted in forums, it only changes sleep level/state,
thus improving pref as stuff isnt going to sleep as deep/long etc, not because of shifting load around on cores/ccx.

only thing that can "fix" the messed up (intel preferred) scheduler, is MS.
 
Don't some boards' BIOSs allow disabling Hyper Threading? Or in the case of Ryzen; SMT? (I'm not on my MSI Z390-A Pro right now to check) I'm on an aging Asus M9A99X EVO at present.
you can disable it in BIOS
 
Thanks everyone for your help with my question. Is there a way to choose a best answer?
 
Thanks everyone for your help with my question. Is there a way to choose a best answer?

For multi-threaded applications the OS handles this. How many threads there are is up to the software developer. I know there are many, many games that are optimized at 4 threads and a lot don't use any more. But the OS will take what it's given and decide on what cores it will use.

But it is also an option for the developer to choose affinity by telling the OS "I have 8 threads, reduce affinity to the physical cores". Technically they are telling the OS to not use hyperthreading or SMT.
 
@clutchc
lol, this isnt "yahoo answers" :D


@Snootch
nope, they cant assign cores. or we wouldnt need things like process lasso to "fix" it, or ppl with more than 8C wouldn't see fps improvement by turning smt off.
win is tweaked for intel (years of being the "top" cpu), which werent doing much with cores until zen.
 
Last edited:
@clutchc
lol, this isnt "yahoo answers" :D
Oh, OK. Thanks. Didn't want to leave without giving credits. I'm used to Tom's Hardware forum I guess, where they want you to assign best answer.
 
No worries, just messin with ya
 
When an executable program runs and needs to start another thread, does it first utilize a core's Hyper-Threading (Simultaneous Multi-Threading for AMD) capability for that thread... or does it utilize the next real core? In otherwords, are all the real cores used first?
Operating system thread scheduler makes all of these decisions unless the application explicitly manages thread allocation. The thread scheduler follows rules based on power config (some cores might be parked/power saving), burden (it generally moves threads to cores that aren't busy), and capabilities (was important back in the P4 w/ HT era but not so much any more because execution cores are so much more efficient at changing contexts).

When you initially start a program, the virtual thread it occupies is almost always chosen by the operating system. This main thread is also usually the least busy in multithreaded software.

Windows 10 has a much better thread scheduler than Windows 7 did, and Windows 7 had a much better thread scheduler than Windows XP.

@Snootch
nope, they cant assign cores. or we wouldnt need things like process lasso to "fix" it, or ppl with more than 8C wouldn't see fps improvement by turning smt off.
win is tweaked for intel (years of being the "top" cpu), which werent doing much with cores until zen.
Microsoft disagrees:
 
Last edited:
Back
Top