Member-only story
Concurrency vs. Parallelism Using Kotlin
Understand the differences

The official Kotlin documentation describes Kotlin Coroutines as a tool “for asynchronous programming and more”. Their main purpose is to provide programmers with easy tools for “asynchronous or non-blocking” programming. What exactly does this mean? How is “asynchrony” related to the terms “concurrency” and “parallelism”, terms we hear a lot in this context, oftentimes mixed up?
In this article, we will see that coroutines are mostly concerned about concurrency and not primarily about parallelism. Coroutines provide sophisticated means for helping us structure code in order to make it highly concurrently executable. In addition, they allow enabling parallelism, which isn’t the default behavior necessarily. If you don’t fully grasp the difference between both concepts yet, don’t worry, it should get clearer throughout this article. Many people, myself included, struggle to make use of these terms correctly. Let’s learn more about coroutines and how they relate to the discussed topics.
(You can find a general introduction to Kotlin coroutines in this old article)
Asynchrony — A programming model
Asynchronous programming is a topic we’ve been reading and hearing about a lot in the last couple of years. It…