开发者

Achieving multi-core in Java - how?

开发者 https://www.devze.com 2023-01-25 23:02 出处:网络
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

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, o开发者_C百科r 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.


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.


Scala is quite popular for this. It runs on the JVM and has bindings for Java to hook them together.

0

精彩评论

暂无评论...
验证码 换一张
取 消