Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Achieving multi-core in Java - how?

Tags:

java

multicore

What is the easiest way in Java for achieving multi-core? And by this, I mean, to specifically point out on what core to execute some parts of the project, so good-old "normal" java threads are not an option.

So far, I was suggested JConqurr (which is an Eclipse toolkit for multi-core programming in java), JaMP (which extends Java for OpenMP), and MPJ express, of which I don't know much. Which of the above do you consider the best, or do you have other suggestions? It would be preferable to somehow mesure the performance boost/gain, but not exclusive.

Any help would be much appreciated. Thanks, twentynine.

like image 700
twentynine Avatar asked Nov 21 '10 09:11

twentynine


1 Answers

Even though it is easy to write multi-threaded code in Java, there is nothing in the Java standard runtime which generically allow you to tell the JVM or the operating system how to schedule your program.

Hence you will need to have code specifically for your JVM and/or your operating system, and that code may not be doable in Java (unless you dive into JNI or JNA). External programs can pin processes to a CPU in many Unix versions (and probably Windows too), but I don't think you can do this for individual threads.

like image 106
Thorbjørn Ravn Andersen Avatar answered Sep 23 '22 10:09

Thorbjørn Ravn Andersen