Concurrency in Kotlin: Asynchronous and Multithreaded Programming
300 pages
English
PDF
4.5

Concurrency in Kotlin: Asynchronous and Multithreaded Programming

Concurrency in Kotlin: Asynchronous and Multithreaded Programming

Author:

Year:

Summary:

The book "Concurrency in Kotlin" is a comprehensive guide to asynchronous and multithreaded programming in the Kotlin language. Unlike many other publications, this book does not just introduce the syntax of coroutines, but teaches you to think in the paradigm of concurrent code, avoid locks, and build fault-tolerant applications.



What this book is about

The author systematically reveals all levels of concurrency in Kotlin: from classic Java threads (Thread) to modern coroutines, channels, and Flow. You will learn:

  • JMM and Thread Basics: how memory, synchronization, volatile, atomic types, and thread pools work.
  • Coroutines: building lightweight "green" threads, suspend functions, Scopes, and Dispatchers.
  • Channels: data exchange between coroutines, fan-out/fan-in patterns.
  • Flow and Reactive Streams: cold and hot streams, operators, error handling, backpressure.
  • Structured Concurrency: cancellation and exception handling, SupervisorJob, CoroutineExceptionHandler.
  • Testing: how to write unit tests for asynchronous code, use TestCoroutineDispatcher.


Who this book is for

The book will be useful for:

  • Java developers transitioning to Kotlin (especially for Android and backend);
  • Developers who already write in Kotlin but want to understand coroutines more deeply and avoid common mistakes (e.g., memory leaks or deadlocks);
  • Students and novice engineers learning modern approaches to asynchrony.

Reading requires a basic knowledge of Kotlin syntax and a general understanding of what a thread is. All complex concepts (e.g., "structured concurrency" or "backpressure") are explained from scratch.



What you will learn after reading

  • How to correctly choose between threads and coroutines for a specific task.
  • How to design an application architecture that is resistant to data races and locks.
  • How to use Flow for asynchronous data processing (e.g., loading a list with pagination).
  • How to test asynchronous code without "sleep" and timeouts.
  • How to work with channels to organize pipeline processing.

The book contains over 50 practical examples and exercises with solutions. All examples are written for Kotlin 1.9+ and are compatible with the latest versions of coroutines (1.7+).



Buy the book "Concurrency in Kotlin" at PythonLib — means getting not just theory, but ready-made tools for creating fast and reliable applications in Kotlin.

Recommendations