Better Programming

Advice for programmers.

Follow publication

Member-only story

Concurrency vs. Parallelism Using Kotlin

Simon Wirtz
Better Programming
Published in
8 min readSep 3, 2022

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…

Create an account to read the full story.

The author made this story available to Medium members only.
If you’re new to Medium, create a new account to read this story on us.

Or, continue in mobile web

Already have an account? Sign in

Simon Wirtz
Simon Wirtz

Written by Simon Wirtz

🌍 🧑‍💻 I am a Freelance Software Engineer and Expert for Kotlin and Java. I write about code, software engineering, interviewing, traveling, and more 🔥

Write a response