I've searched through the VB.NET documentation, but couldn't find any way of detecting the number of CPUs (logical or physical) on a system. Anyone know how to do this?
Some interesting reading on thread classes, but it doesn't mention anything about processors. I've alredy written a program using the Thread class, but I currently hardcode the number of threads I'm using, and would prefer to optimize that number based on available hardware.
This should work on windows NT and higher (It works on my xp machine anyway):
-----------------------------------------------
MessageBox.Show(System.Environment.GetEnvironmentVariable("NUMBER_OF_PROCESSORS")
-----------------------------------------------
Sunaj
'The gap between theory and practice is not as wide in theory as it is in practice'
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.