官术网_书友最值得收藏!

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 7Thread Confinement, Actors, and Mutexes, and Chapter 8Testing Concurrent Code, will focus on the correct usage of channels, actors, mutexes, and more to correctly communicate and synchronize your concurrent code.
主站蜘蛛池模板: 商南县| 嘉祥县| 建平县| 新巴尔虎右旗| 临朐县| 东莞市| 石楼县| 景德镇市| 奈曼旗| 吉首市| 天全县| 福海县| 马山县| 九寨沟县| 宜城市| 石阡县| 股票| 濮阳县| 克东县| 二连浩特市| 桓台县| 宿迁市| 阿荣旗| 香格里拉县| 揭西县| 正阳县| 桓仁| 瑞安市| 大丰市| 左云县| 雅江县| 顺昌县| 和静县| 郴州市| 新乡县| 扬中市| 隆子县| 霍州市| 安仁县| 山阳县| 巴林右旗|