I guess there is no equivalent of task parallel libraries (of .NET 4.0) in Java. Is that true? What are the improvements that this feature of .NET offer that Java concurrency doesn't.
The Task Parallel Library (TPL) is a set of public types and APIs in the System. Threading and System. Threading. Tasks namespaces. The purpose of the TPL is to make developers more productive by simplifying the process of adding parallelism and concurrency to applications.
Compared to the classic threading model in . NET, Task Parallel Library minimizes the complexity of using threads and provides an abstraction through a set of APIs that help developers focus more on the application program instead of focusing on how the threads will be provisioned.
Task parallelism is the process of running tasks in parallel. Task parallelism divides tasks and allocates those tasks to separate threads for processing. It is based on unstructured parallelism.
The Parallel class provides library-based data parallel replacements for common operations such as for loops, for each loops, and execution of a set of statements.
Java has the java.util.concurrent
package, and there's also the fork/join framework. Fork/join is scheduled for inclusion in Java 7, but can be downloaded now and used with Java 6.
A good book for getting to grips with concurrency in Java is Java Concurrency in Practice, by Brian Goetz and others.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With