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

  • 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 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.
主站蜘蛛池模板: 东乡族自治县| 姜堰市| 湖北省| 文山县| 岳普湖县| 宁河县| 南城县| 三明市| 凉城县| 沁阳市| 炎陵县| 屏南县| 新巴尔虎右旗| 营山县| 梧州市| 商河县| 湛江市| 剑河县| 蓬莱市| 永嘉县| 康定县| 万荣县| 神农架林区| 阳城县| 丹棱县| 隆昌县| 鄂伦春自治旗| 镇远县| 满城县| 高安市| 盐源县| 马龙县| 綦江县| 成武县| 阳新县| 康平县| 瓦房店市| 太和县| 崇义县| 金塔县| 巴青县|