- Learning Concurrency in Kotlin
- Miguel Angel Castiblanco Torres
- 167字
- 2021-08-05 10:46:44
Non-blocking
Threads are heavy, expensive to create, and limited—only so many threads can be created—So when a thread is blocked it is, in a way, being wasted. Because of this, Kotlin offers what is called Suspendable Computations; these are computations that can suspend their execution without blocking the thread of execution. So instead of, for example, blocking thread X to wait for an operation to be made in a thread Y, it's possible to suspend the code that has to wait and use thread X for other computations in the meantime.
Furthermore, Kotlin offers great primitives like channels, actors, and mutual exclusions, which provide mechanisms to communicate and synchronize concurrent code effectively without having to block a thread.
Chapter 6, Channels – Share Memory by Communicating, Chapters 7, Thread Confinement, Actors, and Mutexes, and Chapter 8, Testing Concurrent Code, will focus on the correct usage of channels, actors, mutexes, and more to correctly communicate and synchronize your concurrent code.
推薦閱讀
- Practical Data Analysis Cookbook
- jQuery EasyUI網(wǎng)站開發(fā)實戰(zhàn)
- Windows Server 2016 Automation with PowerShell Cookbook(Second Edition)
- C語言程序設計學習指導與習題解答
- ArcGIS for Desktop Cookbook
- 深入淺出Go語言編程
- JavaScript程序設計(第2版)
- Advanced UFT 12 for Test Engineers Cookbook
- 零代碼實戰(zhàn):企業(yè)級應用搭建與案例詳解
- Windows Phone 8 Game Development
- Building Slack Bots
- Instant Apache Camel Messaging System
- Flink入門與實戰(zhàn)
- Getting Started with hapi.js
- 企業(yè)級Java現(xiàn)代化:寫給開發(fā)者的云原生簡明指南