I want to make some tuning for multithreaded program.
If I know how much threads can really work in parallel I can make the program much more effective.
Is there
How about (code snippets speak a 1000 words):
public class Main {
/**
* Displays the number of processors available in the Java Virtual Machine
*/
public void displayAvailableProcessors() {
Runtime runtime = Runtime.getRuntime();
int nrOfProcessors = runtime.availableProcessors();
System.out.println("Number of processors available to the Java Virtual Machine: " + nrOfProcessors);
}
public static void main(String[] args) {
new Main().displayAvailableProcessors();
}
}