I am pretty new to multithreading, and I am working on a project where I am trying to utilize 4 CPUs in my Java program. I wanted to do something like
int numP
no it won't guarantee anything about where the threads run
in fact the OS thread scheduler is free to migrate threads around cores as it sees fit (so one line you could be on core 0 and the next on core 4)
you could set the affinity of threads but this is not available in java directly (AFAIK)