How can we do Parallel Programming in Java? Is there any special framework for that? How can we make the stuff work?
I will tell you guys what I need, think that I devel
I have heard about one at conference a few years ago - ParJava. But I'm not sure about the current status of the project.
There is a library called Habanero-Java (HJ), developed at Rice University that was built using lambda expressions and can run on any Java 8 JVM.
HJ-lib integrates a wide range of parallel programming constructs (e.g., async tasks, futures, data-driven tasks, forall, barriers, phasers, transactions, actors) in a single programming model that enables unique combinations of these constructs (e.g., nested combinations of task and actor parallelism).
The HJ runtime is responsible for orchestrating the creation, execution, and termination of HJ tasks, and features both work-sharing and work-stealing schedulers. You can follow the tutorial to set it up on your computer.
Here is a simple HelloWorld example:
import static edu.rice.hj.Module1.*;
public class HelloWorld {
public static void main(final String[] args) {
launchHabaneroApp(() -> {
finish(() -> {
async(() -> System.out.println("Hello World - 1!"));
async(() -> System.out.println("Hello World - 2!"));
async(() -> System.out.println("Hello World - 3!"));
async(() -> System.out.println("Hello World - 4!"));
});
});
}}
Each async method runs in parallel with the other async methods, while the content within these methods run sequentially. The program doesn't continue until all code within the finish method complete.
You want to look at the Java Parallel Processing Framework (JPPF)
java.util.concurrency package and the Brian Goetz book "Java concurrency in practice"
There is also a lot of resources here about parallel patterns by Ralph Johnson (one of the GoF design pattern author) : http://parlab.eecs.berkeley.edu/wiki/patterns/patterns
Parallelism
Parallelism means that an application splits its tasks up into smaller subtasks which can be processed in parallel, for instance on multiple CPUs at the exact same time.
This is the parallel programming resource I've been pointed to in the past:
http://www.jppf.org/
I have no idea whether its any good or not, just that someone recommended it a while ago.