Concurrency vs Multithreading in Java

In our previous article we discussed about concurrency, parallelism and how concurrency enables parallelism.

It means that the target of a Java developer should be to build a concurrent application which will further enable parallelism, right?

Then how does multithreading fits the role in making an application concurrent?

After this article you will understand:

  1. How concurrency relates to multithreading.
  2. What is the difference between concurrency and multithreading

So, stay tuned!!

Current article is part of our series on multithreading in java.

What is Concurrency?

Let’s just borrow the definition from our earlier understanding:

“Concurrency is the ability of an application to handle multiple things at the same or overlapping time.”

The key is: handling. But, how can we handle multiple things in an application?

Answer is: By creating multiple execution units/pieces within an application.

And how can we create these different units in an application? – With Multithreading.

What is Multithreading?

Multithreading simply means that we are using multiple threads. A multithreaded application represents multiple threads at work. That’s it.

As a thread is smallest unit of execution, each thread can work as a separate execution unit of an application. And this is exactly what we require to create fully functional concurrent system.

Multiple threads == Multiple execution units == Concurrency.

So, Java has provided the concept of multithreading (threads) with the help of which we can build concurrent systems.

Concurrency vs Multithreading

ConcurrencyMultithreading
Concurrency is the ability of a system to handle multiple things by creating multiple execution units.Multithreading is the concept which helps create multiple execution units.
It works as target to achieve for a Java developer.It works as a tool to achieve the concurrency target.

Key Points on Concurrency vs Multithreading

  1. Target of a Java developer should be to build a truly concurrent system.
  2. We need multiple execution units to execute concurrently or in parallel, in an application.
  3. Threads (Multithreading) is the tool provided by Java to help build these execution units.

Leave a Comment