Parallel programming in Java

后端 未结 19 1142
时光说笑
时光说笑 2021-01-30 11:14

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

相关标签:
19条回答
  • 2021-01-30 11:20

    I have heard about one at conference a few years ago - ParJava. But I'm not sure about the current status of the project.

    0 讨论(0)
  • 2021-01-30 11:22

    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.

    0 讨论(0)
  • 2021-01-30 11:25

    You want to look at the Java Parallel Processing Framework (JPPF)

    0 讨论(0)
  • 2021-01-30 11:25

    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

    0 讨论(0)
  • 2021-01-30 11:33

    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.

    0 讨论(0)
  • 2021-01-30 11:34

    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.

    0 讨论(0)
提交回复
热议问题