23 Nov
2007
23 Nov
'07
5:42 p.m.
On Fri, Nov 23, 2007 at 02:34:27PM +0100, misiu wrote:
I've developed small application which has a few threads. So far I'm using only single CPU (one core) and my question is: what will happen if I'm using more CPUs (or cores)? Whether threads will be automatically executed on different CPUs in parallel or not? If not what is a solution to run them in parallel?
The OS scheduler decides how threads are distributed across CPUs (and when they are run). On a quad-core machine, your program may at any given time use from 0 to all 4 CPUs (provided you have >= 4 threads), depending on other active applications and the current system load.