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

Working with coroutines

A program in execution that initiates long-running operations, such as file IO, network IO, or CPU- or GPU-intensive work, requires the invoker to block until the operations complete. Programming languages handle this via concurrency. 

The JVM has support for concurrency. Java has had strong support for multithreading and concurrency since its first release. Any process that is running inside the JVM can create a number of threads to execute multiple tasks in an asynchronous fashion. However, developing concurrent code in an optimal and error-free manner and debugging it is really challenging. Java provides various constructs to write concurrent code and, along with other JVM languages and third-party libraries, has tried to come up with innovative and elegant ways to achieve concurrency.

Java 5 made a lot of progress with regard to writing concurrent applications. It has higher-level constructs, such as the executor framework, which makes it easier to write concurrent code and allows us to decouple thread management code from the business logic. Java 8 has introduced parallel streams to turn the code to concurrent much more easily. RxJava brings reactive extensions to Java, allowing us to write very concise code for asynchronous functionality. Kotlin supports almost all of those approaches and offers a few of its own as well.

主站蜘蛛池模板: 定兴县| 桃源县| 习水县| 大连市| 象州县| 泰兴市| 丹巴县| 诸暨市| 高州市| 任丘市| 文成县| 荣昌县| 同仁县| 通榆县| 济阳县| 民乐县| 故城县| 泸定县| 房山区| 甘洛县| 乌苏市| 马公市| 宝应县| 枞阳县| 霍州市| 印江| 香港| 广元市| 商河县| 台中市| 武威市| 通渭县| 衡阳市| 虎林市| 泊头市| 钟祥市| 清流县| 宁河县| 株洲市| 民乐县| 大理市|