Learning Concurrency in Kotlin: Build highly efficient and robust applications
Miguel Angel Castiblanco Torres
- 出版商: Packt Publishing
- 出版日期: 2018-07-28
- 售價: $1,970
- 貴賓價: 9.5 折 $1,872
- 語言: 英文
- 頁數: 266
- 裝訂: Paperback
- ISBN: 1788627164
- ISBN-13: 9781788627160
-
相關分類:
JVM 語言
海外代購書籍(需單獨結帳)
相關主題
商品描述
Take advantage of Kotlin's concurrency primitives to write efficient multithreaded applications
Key Features
- Learn Kotlin’s unique approach to multithreading
- Work through practical examples that will help you write concurrent non-blocking code
- Improve the overall execution speed in multiprocessor and multicore systems
Book Description
The primary requirements of modern-day applications are scalability, speed, and making the most use of hardware. Kotlin meets these requirements with its immense support for concurrency. Many concurrent primitives of Kotlin, such as channels and suspending functions, are designed to be non-blocking and efficient. This allows for new approaches to concurrency and creates unique challenges for the design and implementation of concurrent code. Learning Concurrency in Kotlin addresses those challenges with real-life examples and exercises that take advantage of Kotlin's primitives. Beginning with an introduction to Kotlin's coroutines, you will learn how to write concurrent code and understand the fundamental concepts needed to be able to write multithreaded software in Kotlin. You'll explore how to communicate between and synchronize your threads and coroutines to write asynchronous applications that are collaborative. You'll also learn how to handle errors and exceptions, as well as how to leverage multi-core processing. In addition to this, you’ll delve into how coroutines work internally, allowing you to see the bigger picture. Throughout the book you'll build an Android application – an RSS reader – designed and implemented according to the different topics covered in the book
What you will learn
- Understand Kotlin’s approach to concurrency
- Implement sequential and asynchronous suspending functions
- Create suspending data sources that are resumed on demand
- Explore the best practices for error handling
- Use channels to communicate between coroutines
- Uncover how coroutines work under the hood
Who this book is for
If you’re a Kotlin or Android developer interested in learning how to program concurrently to enhance the performance of your applications, this is the book for you.
Table of Contents
- Hello Concurrent World!
- Coroutines in Action
- Lifecycle and Error Handling
- Suspending Functions and The Coroutine Context
- Generators: Iterators and Sequences_noimages
- Channels: Share Memory by Communicating
- Thread Confinement, Actors, and Mutexes
- Testing Concurrent Code
- How Coroutines Work?
商品描述(中文翻譯)
利用 Kotlin 的並發原語來編寫高效的多執行緒應用程式
主要特點
- 學習 Kotlin 獨特的多執行緒處理方式
- 通過實際範例幫助您編寫並發的非阻塞代碼
- 提高多處理器和多核心系統的整體執行速度
書籍描述
現代應用程式的主要需求是可擴展性、速度以及充分利用硬體。Kotlin 以其對並發的強大支持來滿足這些需求。Kotlin 的許多並發原語,如通道和掛起函數,旨在實現非阻塞和高效。這為並發提供了新的處理方式,並為並發代碼的設計和實現帶來了獨特的挑戰。《Learning Concurrency in Kotlin》針對這些挑戰,提供了利用 Kotlin 原語的實際範例和練習。從 Kotlin 的協程介紹開始,您將學習如何編寫並發代碼,並理解編寫 Kotlin 多執行緒軟體所需的基本概念。您將探索如何在執行緒和協程之間進行通信和同步,以編寫協作的非同步應用程式。您還將學習如何處理錯誤和異常,以及如何利用多核心處理。此外,您將深入了解協程的內部運作,讓您看到更大的全貌。在整本書中,您將構建一個 Android 應用程式——一個 RSS 閱讀器,根據書中涵蓋的不同主題進行設計和實現。
您將學習的內容
- 理解 Kotlin 的並發處理方式
- 實現順序和非同步的掛起函數
- 創建按需恢復的掛起數據源
- 探索錯誤處理的最佳實踐
- 使用通道在協程之間進行通信
- 揭示協程的內部運作原理
本書適合誰
如果您是 Kotlin 或 Android 開發者,對學習如何進行並發編程以提升應用程式性能感興趣,那麼這本書就是為您而寫的。
目錄
1. 你好,並發世界!
2. 協程實戰
3. 生命週期與錯誤處理
4. 掛起函數與協程上下文
5. 生成器:迭代器與序列
6. 通道:通過通信共享記憶體
7. 執行緒限制、演員與互斥鎖
8. 測試並發代碼
9. 協程是如何運作的?