Channels ▼

Gastón Hillar

Dr. Dobb's Bloggers

Java 7 Will Evolve to Fine-grained Parallelism

April 15, 2009

Java's development team understands the multicore revolution and is working hard in offering a new concurrency framework taking into account the new possibilities offered by the new microprocessors. Hence, JDK 7 (Java Development Kit 7) will offer the fork-join framework in order to help Java developers to tackle the multicore revolution using this popular programming language.I'm going to borrow some words from Charles Darwin's "The Origin of the Species" and his theory of evolution: "In a very real sense, nature selected the best adapted varieties to survive and to reproduce. This process has come to be known as natural selection."

I'm pretty sure that developers will select the best adapted programming languages to survive in the parallelism age. This process is also known as natural selection. Programming languages that do not evolve to support multicore programming won't have chances to survive in this new era. Luckily, JDK 7 will offer many improvements that will seduce multicore programmers.

Java supports multithreading since its first version. However, multicore microprocessors were not available when Java was born. This old threading model was useful to create more responsive applications using only one processing core, but it wasn't prepared for high concurrency levels. This model is not suitable for multicore programming that requires many concurrent tasks taking full advantage of all the available cores.

JDK 5 added support for coarse-grained concurrency. However, this model is suitable for multiprocessor systems (MP systems). Therefore, JDK 7 adds support for fine-grained parallelism, offering the developers the possibility to exploit multicore microprocessors using the new fork-join framework.

Definitely, Java is evolving to survive the multicore revolution. This new framework offers the possibility of working with tasks, instead of using more expensive threads. For example, the new package java.util.concurrent.forkjoin, proposed for JDK 7 release offers the following useful base classes:

* RecursiveAction: To represent divide-and-conquer solutions. * RecursiveTask: To represent result-bearing tasks. * AsyncAction: To work with tasks that require asynchronous completion. * CyclicAction: To work with parallel iterative tasks.

The new fork-join tasks are designed to minimize the overhead and to improve the performance offered by compute-intensive tasks. Besides, the code is easier to understand than the old threaded version and the developers require less synchronization.

This new framework is very useful for compute-intensive tasks running on multicore CPUs.

There are many other features that will be available in JDK 7, like the new ParallelArray. However, I wanted to keep the focus on a short and simple introduction to the new fork-join framework.

Java is evolving. Thus, Java developers must also evolve to take advantage of these forthcoming features.

For more details, go here and watch the excellent slides of "Let's Resync. Concurrency Features in JDK 7", by Brian Goetz, Sr. Staff Engineer, Sun Microsystems.

Related Reading


More Insights






Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

 
Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.
 


Video