Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Learning Concurrency in Kotlin

You're reading from   Learning Concurrency in Kotlin Build highly efficient and scalable applications

Arrow left icon
Product type Paperback
Published in Jul 2018
Publisher Packt
ISBN-13 9781788627160
Length 266 pages
Edition 1st Edition
Languages
Concepts
Arrow right icon
Author (1):
Arrow left icon
Miguel Angel Castiblanco Torres Miguel Angel Castiblanco Torres
Author Profile Icon Miguel Angel Castiblanco Torres
Miguel Angel Castiblanco Torres
Arrow right icon
View More author details
Toc

Table of Contents (11) Chapters Close

Preface 1. Hello, Concurrent World! 2. Coroutines in Action FREE CHAPTER 3. Life Cycle and Error Handling 4. Suspending Functions and the Coroutine Context 5. Iterators, Sequences, and Producers 6. Channels - Share Memory by Communicating 7. Thread Confinement, Actors, and Mutexes 8. Testing and Debugging Concurrent Code 9. The Internals of Concurrency in Kotlin 10. Other Books You May Enjoy

What this book covers

Chapter 1, Hello, Concurrent World!, is a friendly introduction to concurrency. Starting with concepts such as processes, threads, and coroutines, and then diving into the differences between concurrency and parallelism, you will learn about the common challenges of concurrent code, Kotlin's approach to concurrency, and some of the terminology that will be needed throughout the book.

Chapter 2, Coroutines in Action, takes you through a hands-on first experience with coroutines. We will create an empty Android project and work our way to doing networking using coroutines. We will also discuss different approaches to asynchronous operations with their advantages and my recommendations.

Chapter 3, Lifecycle and Error Handling, explains the lifecycle of coroutines and how to handle errors when using them. Then, we will put the theory in practice by adding error handling to the RSS reader created in the previous chapter.

Chapter 4, Suspending Functions and the Coroutine Context, covers the essential coroutine context, the one piece of configuration of your coroutine that allows you to define and modify its behavior. We will cover the usage of contexts to define the thread of a coroutine and for error handling.

Chapter 5, Iterators, Sequences, and Producers, dives into some primitives that allow data sourcing and data processing to be made suspending. We will talk, in detail, about how and when to use them, and we'll put this knowledge to test by implementing content loading on demand.

Chapter 6, Channels, Share Memory by Communicating, explains the really important concept of channels, starting with their use cases, covering the different types and their differences, and making it to a real-life application. We will use channels to perform concurrent searches in a group of RSS feeds.

Chapter 7, Thread Confinement, Actors, and Mutexes, lists three different tools that are provided by the coroutines framework to avoid errors such as atomicity violations and race conditions. In this chapter, you will learn how to use thread confinement, actors, and mutual exclusions, which are fundamental when writing safe concurrent code.

Chapter 8, Testing and Debugging Concurrent Code, focuses on how to make the most out of your tests. We talk about functional tests, the three premises for testing concurrent code, and the configuration of your project to make the most out of your logs. We will also cover how to debug your concurrent code so that you avoid noise from other threads or coroutines.

Chapter 9, The Internals of Concurrency in Kotlin, analyzes how suspending functions, thread enforcing, and exception handling work during execution. It gives you a low-level understanding by both describing what the compiler does and by exploring the current implementation of many of the classes, both in the stdlib and in the coroutines library.

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image