6

Concurrency in Kotlin

“Juggling is an illusion. . . . In reality, the balls are being independently caught and thrown in rapid succession. . . . It is actually task switching.”

Gary Keller

Since the emergence of multicore processors, concurrency has become an omnipresent topic. However, concurrency is hard and comes with a list of hard-to-debug problems. This chapter briefly introduces the basic concepts surrounding concurrency, introduces Kotlin’s coroutines as a unique approach to concurrency, and shows how to represent a variety of asynchrony and concurrency patterns with coroutines.

Concurrency

In today’s world of REST1 APIs and microservices, concurrency and asynchrony play a central role for developers. On Android, apps may not actually ...

Get Kotlin for Android App Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.