• Some users have recently had their accounts hijacked. It seems that the now defunct EVGA forums might have compromised your password there and seems many are using the same PW here. We would suggest you UPDATE YOUR PASSWORD and TURN ON 2FA for your account here to further secure it. None of the compromised accounts had 2FA turned on.
    Once you have enabled 2FA, your account will be updated soon to show a badge, letting other members know that you use 2FA to protect your account. This should be beneficial for everyone that uses FSFT.

How does a Program/OS determine which cores to use?

GotNoRice

[H]F Junkie
2FA
Joined
Jul 11, 2001
Messages
12,827
I have two similar hypothetical scenarios here that I’m curious about:

On my Q6600, if only two cores are being used by a particular program, that could mean the two cores that are being used are sharing a single block of L2 cache (not ideal), or that each core has it’s own block of L2 cache (ideal) all depending on which two cores are used.

Similarly, I have an older Dual Xeon rig. Each of the Xeons has hyperthreading for a total of 4 virtual processors. If only two of the virtual processors are being used, the program could either be running on two virtual processors from the same physical processor (certainly not ideal), or two virtual processors from different physical processors (ideal).

In these sorts of situations what exactly determines which cores or virtual processors a program runs on to ensure maximum performance? Is this something the OS handles automatically, without the need to set affinity or anything? Is there any difference in the way this is handled in XP vs. Vista?
 
It's all run by the OS (Kernel)

Ok.

But what exactly does it do? Does it actually set a preference for certain cores? Does it even approach it from an intelligent way or is it just random?
 
it flips a virtual coin .. when said coin lands on it's edge you get a BSOD. :p
 
I am sure if you googled how the kernel does load balancing you'd find alot. Unless you are interested in reading a bunch of dry technical crap I'd just be happy it works and move along.
 
I am sure if you googled how the kernel does load balancing you'd find alot.

Yeah I am sure that 95% of the questions on this forum have an answer somewhere on google, but thanks.

Unless you are interested in reading a bunch of dry technical crap I'd just be happy it works and move along.

Or maybe I actually care about how my computers work, and wish to inquire about it with like-minded people. :rolleyes:

Google gave me wiki as 1. option, seems sufficent for basic understading:
http://en.wikipedia.org/wiki/Multi-threading

Looking for something a bit more specific to my question than a wiki basically on “how multi-threading works” but thanks.
 
Google is your friend. Less than 1% of us understand it, and less than 0.00000001% even care.

I'm sorry that you don't feel my question was worth asking on here. I guess you think the forum is meant for what, bragging all day and rehashing the same top 20 noob questions over and over again? At one point it wasn't abnormal for people to ask technical questions around here :rolleyes:


The article explained a bit about how windows balances tasks in a multiple CPU box, but doesn't say anything about what it does if certain CPU loading scenarios are more preferable than others, which is really what my question is about.

Hit kernel.org, DL the latest linux kernel and search for yourself.

My question didn't have anything to do with linux so not sure why I would do that.
 
Then USE google. Not sure why you're getting all butt hurt about people suggestion you use google. God forbid you actually do some of your own research. Chances are, very few people on here actually know the answer to your question, and an even slimmer chance that someone that knows is reading this thread. Most people that do answer you, probably used google to get their answer, so get over it.
 
The last time I was "up" on the intracacies of a processor was the P1/P2 days. You will have to learn about load balancing etc. A lot of what it does is based on the program it is running and there really is no way to tell unless you wrote the program. Google really is your buddy.
 
You might want to consider ordering the books on how the Intel processor works (from Intel). They actually give em out for free I believe I got my 5 book set 2-3 years ago though.

Also you might have some more help at the Intel forums. http://software.intel.com/en-us/forums/

Let me know what you find. I'm really tired or else I'd research it more... I find it quite interesting. Benching a computer for speed and such is fun and all but really learning about it is more fun me thinks.
 
It's not that we hate you for asking these kinds of questions. It's more of, "this is material that you'd learn in university while taking an operating systems course", so naturally, it'd be best to pick up an OS book and read up on it. Likewise, if I wanted to understand (and be able to prove) soundness and completeness of propositional logic, I wouldn't ask such a question on [H].
 
I have two similar hypothetical scenarios here that I’m curious about:

On my Q6600, if only two cores are being used by a particular program, that could mean the two cores that are being used are sharing a single block of L2 cache (not ideal), or that each core has it’s own block of L2 cache (ideal) all depending on which two cores are used.

Similarly, I have an older Dual Xeon rig. Each of the Xeons has hyperthreading for a total of 4 virtual processors. If only two of the virtual processors are being used, the program could either be running on two virtual processors from the same physical processor (certainly not ideal), or two virtual processors from different physical processors (ideal).

In these sorts of situations what exactly determines which cores or virtual processors a program runs on to ensure maximum performance? Is this something the OS handles automatically, without the need to set affinity or anything? Is there any difference in the way this is handled in XP vs. Vista?

The thread scheduler in the OS may or may not have heuristics to try and optimize performance for such situations.
You can clearly see the difference between Windows 2000 and XP with HyperThreading. 2000 doesn't know anything about HT, and treats all cores as if they are physical CPUs, because it doesn't know anything else. This is what gave HT a bad name.
XP on the other hand recognizes HT and tries to avoid pitfalls.

I don't know if Vista actually knows about the Q6600 and its peculiar shared L2-cache, but I suspect that it doesn't (unlike HT, there's no specific way to detect how a Q6600's cores are made up, so you'd have to make a very specific exception based on the exact CPU models). So it just treats all cores equally.

So in short, normally the OS will take care of it, if it has knowledge of the situation. You could also manually set affinity in your own application, but I have never heard of any application that actually does this, at least not for specific types of CPUs. Generally you just let the OS take care of it, it's usually better at it.
 
Yeah I am sure that 95% of the questions on this forum have an answer somewhere on google, but thanks.

Yea and 95% of the questions asked on these forum boards arent nearly as technical as what you're asking. Hence why he told you to google it. And your poor attitude doesnt exactly make people want to do the leg work for you either.
 
Yea and 95% of the questions asked on these forum boards arent nearly as technical as what you're asking. Hence why he told you to google it. And your poor attitude doesnt exactly make people want to do the leg work for you either.

I wasn’t expecting anyone to do any legwork. This is a question I first asked over 5 years ago when I first built my Dual Xeon box when 4 Virtual processors was a very niche config and have certainly searched Google and asked many people during that time.

Since then the norm has gone from using a single processor to even some office/web boxes having quad core chips. I just figured that given how common this technology is becoming that there might now be people who are just more familiar with the tech and how it works in general who might be able to give a straight forward answer.

In addition I see many questions asked on these and other forums that relate directly to this question.

Take for example, when someone is comparing a Quad vs a Duo, something that is a pretty hot topic at the moment. A Q6600 for example has 8MB cache total, a E8x00 has 6MB cache total. Which one has the cache advantage?

Running a game or app that makes use of two cores, on a Q6600 the worst case scenario is the two cores will share 4MB for approx 2MB each, the best case is each core will have 4MB. On an E8x00 the two cores will share 6MB for approx 3MB each. So depending on which cores of the Q6600 are being utilized, it will either have more or less cache at its disposal than a 45nm Duo.

I also hear plenty of off-hand remarks such as “Vista is better for Quads” and I wonder why, or if it has anything to do with this sort of thing.

Also consider that i7 is just around the corner, and is going to re-introduce hyperthreading. It seems to me that these sorts of issues are only going to become more and more relevant.

The thread scheduler in the OS may or may not have heuristics to try and optimize performance for such situations.
You can clearly see the difference between Windows 2000 and XP with HyperThreading. 2000 doesn't know anything about HT, and treats all cores as if they are physical CPUs, because it doesn't know anything else. This is what gave HT a bad name.
XP on the other hand recognizes HT and tries to avoid pitfalls.

I don't know if Vista actually knows about the Q6600 and its peculiar shared L2-cache, but I suspect that it doesn't (unlike HT, there's no specific way to detect how a Q6600's cores are made up, so you'd have to make a very specific exception based on the exact CPU models). So it just treats all cores equally.

So in short, normally the OS will take care of it, if it has knowledge of the situation. You could also manually set affinity in your own application, but I have never heard of any application that actually does this, at least not for specific types of CPUs. Generally you just let the OS take care of it, it's usually better at it.

I appreciate your insight.
 
GotNoRice, no one is saying it's a stupid question or that it is not relevant. Any criticisms in this thread have absolutely nothing to do with the question, but have everything to do with you almost getting offended at someone suggesting the use of google.
 
Any criticisms in this thread have absolutely nothing to do with the question

Got that right. Come to think of it, what does either of your posts have to do with my question? You just feel like going from thread to thread telling people to search Google instead of actually helping them in any way? That’s certainly the impression I got, and why I may have been offended.

I mean if you don’t know the answer that’s fine but let’s not kid anyone here into thinking that Google is really very helpful in these sorts of situations.

As I’ve said this isn’t the first, second, third, or even the tenth time I’ve searched on google about this. All I see are endless tech documents, of which I’d bet less than 5% are even relevant to my question, that I could probably read for days and not have any better understanding of my question than I do now.

To each their own, but I’ve found that the most efficient way for me to learn about something is to seek out a peer who has a better understanding and then if I want to research it further at least I have somewhere to start. I don’t think I’ve ever really learned anything the other way around.
 
As I’ve said this isn’t the first, second, third, or even the tenth time I’ve searched on google about this. All I see are endless tech documents, of which I’d bet less than 5% are even relevant to my question, that I could probably read for days and not have any better understanding of my question than I do now.

You are asking a question that is extremely complicated, all your gonna get it tech documents, the decision flow chart alone is likely monstrous!

Sorry, but your gonna have to look this one up yourself, nobody here is gonna type a 20 page document for you. If your lucky somebody will post a link to a decent summary.
 
Got that right. Come to think of it, what does either of your posts have to do with my question? You just feel like going from thread to thread telling people to search Google instead of actually helping them in any way? That’s certainly the impression I got, and why I may have been offended.

I mean if you don’t know the answer that’s fine but let’s not kid anyone here into thinking that Google is really very helpful in these sorts of situations.

As I’ve said this isn’t the first, second, third, or even the tenth time I’ve searched on google about this. All I see are endless tech documents, of which I’d bet less than 5% are even relevant to my question, that I could probably read for days and not have any better understanding of my question than I do now.

To each their own, but I’ve found that the most efficient way for me to learn about something is to seek out a peer who has a better understanding and then if I want to research it further at least I have somewhere to start. I don’t think I’ve ever really learned anything the other way around.

No, not every thread, just yours, beucase you're acting like a little brat.
 
I have two similar hypothetical scenarios here that I’m curious about:

On my Q6600, if only two cores are being used by a particular program, that could mean the two cores that are being used are sharing a single block of L2 cache (not ideal), or that each core has it’s own block of L2 cache (ideal) all depending on which two cores are used.

Similarly, I have an older Dual Xeon rig. Each of the Xeons has hyperthreading for a total of 4 virtual processors. If only two of the virtual processors are being used, the program could either be running on two virtual processors from the same physical processor (certainly not ideal), or two virtual processors from different physical processors (ideal).

In these sorts of situations what exactly determines which cores or virtual processors a program runs on to ensure maximum performance? Is this something the OS handles automatically, without the need to set affinity or anything? Is there any difference in the way this is handled in XP vs. Vista?


Yes, this is a rather technical question that you'd have to ask an OS developer about. However, I'm certain there are instructions that an application/OS can execute to retrieve that information from the processor as there are instructions to retrieve SSE/MMX compatibility information. However you point about cache blocks is backward. If you have a single application running two threads on a Q6600, you want them to share the same cache NOT use separate caches, to avoid multiple copies of the same information in cache, and to avoid heavy FSB use (I believe the Q6600 uses the FSB to transmit data from one pair of processors to the other). Of course that's just a fuzzy heuristic, it depends on how independent the two threads are.
 
Back
Top