Possible Duplicate:
Programmatically find the number of cores on a machine
I have a multi-threaded C++ program that runs on Windows, MacOS and Linux. Is there an easy way to find out how many cores the machine on which I am running currently has? My system runs best when it has 1 thread for each core.