Skip to content
Advertisement

Parallel or Concurrency? Java Concurrency name problem

I learn from a cookbook that there is the main difference between the words: Parallel and Concurrency.

  • Parallel: working on multiple tasks with multiple cores / CPUs
  • Concurrency: working on multiple tasks with one core / CPU but with the time-framing mechanism.

So I also learned that Java is the language that using the power of multiple cores to achieve multiple task processing simultaneously. But its package name on this ability is called java.util.concurrency.

Why does java use the word concurrency instead of Parallelism?

Advertisement

Answer

I don’t think that definition of “concurrency” is correct.

The definition provided by Wikipedia is:

“In computer science, concurrency is the ability of different parts or units of a program, algorithm, or problem to be executed out-of-order or at the same time simultaneously partial order, without affecting the final outcome. This allows for parallel execution of the concurrent units, which can significantly improve overall speed of the execution in multi-processor and multi-core systems. In more technical terms, concurrency refers to the decomposability of a program, algorithm, or problem into order-independent or partially-ordered components or units of computation.”

In other words, concurrency includes parallelism. (Or at least, the kind of parallelism you get with multiple conventional CPUs or hyperthreads.)

The article goes into more detail, and gives literature citations for the introduction of the term.

Furthermore, what the Wikipedia article says is consistent with the way that other sources use the term “concurrent”; e.g. Java: Concurrency in Practice by Brian Goetz et al.


Why does Java use the word concurrency instead of Parallelism?

Java is correct in using the term concurrent / concurrency.

The mistake is in the “cookbook” you are using.

Advertisement