How does Java makes use of multiple cores?

You can make use of multiple cores using multiple threads. But using a higher number of threads than the number of cores present in a machine can simply be a waste of resources. You can use availableProcessors() to get the number of cores.

In Java 7 there is fork/join framework to make use of multiple cores.

Related Questions:

Leave a Comment