- Learning Concurrency in Kotlin
- Miguel Angel Castiblanco Torres
- 455字
- 2021-08-05 10:46:39
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.
- Learn Type:Driven Development
- Software Testing using Visual Studio 2012
- NativeScript for Angular Mobile Development
- MySQL數據庫管理與開發實踐教程 (清華電腦學堂)
- STM32F0實戰:基于HAL庫開發
- Access 2010數據庫應用技術(第2版)
- C/C++程序員面試指南
- 圖數據庫實戰
- Regression Analysis with Python
- Learning Node.js for .NET Developers
- Illustrator CS6設計與應用任務教程
- JavaScript程序設計:基礎·PHP·XML
- Backbone.js Testing
- 監控的藝術:云原生時代的監控框架
- Getting Started with Windows Server Security