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

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.
主站蜘蛛池模板: 峡江县| 神农架林区| 德化县| 红桥区| 卢湾区| 抚顺市| 晋城| 白河县| 东源县| 富裕县| 涞水县| 名山县| 河南省| 舞钢市| 兴和县| 龙里县| 双桥区| 仙桃市| 库尔勒市| 大英县| 秦安县| 新巴尔虎左旗| 麟游县| 绍兴市| 申扎县| 屯门区| 保靖县| 和平区| 华安县| 大埔区| 康乐县| 乾安县| 桓仁| 新余市| 建始县| 蓬溪县| 大名县| 德清县| 海阳市| 大埔县| 衡水市|