Multithreading question
BlitzMax Forums/BlitzMax Programming/Multithreading question
| ||
Is there a way to limit the number of cores used within the program. Just for testing - one core vs two cores etc. I could use the set affinity but it's a hastle. Thanks Jim |
| ||
It's kinda up to the o/s to distribute threads across cores... might be some specific api calls you can make though? |
| ||
This will let you set processor affinity programmatically (on Windows)... |
| ||
Many Thanks Jim |
| ||
What does Extern "win32" do? Where are the functions from? Jim Forgot to ask, I've got the i7 quad core and it comes with hyperthreading which shows up as 8 cores. 0 to 7. What are the numbers of the real cores? Last edited 2010 |
| ||
It's there to show Blitzmax you're going to declare and use Windows API functions from DLLs that comes with Windows. Google "Windows API" to learn more about the functions used. |
| ||
Yeah, you can also Google msdn SetProcessAffinityMask (or any of the other functions) to find the docs for these Windows calls. In terms of finding the number of 'real' cores, it's possible, but takes quite a bit of effort -- and for what? Windows is still going to treat it as an 8-core processor no matter what! You could probably use the GetNumaProcessorNodeEx function to work out which of the 8 cores relate to each 'real' core, but I don't think it's worth bothering with, since the information is (practically) useless. |
| ||
Cheers James.. :) |
| ||
That was a slightly overdue thankyou, lol |