Comparison of Structured Concurrency Constructs in Java and Kotlin - Virtual Threads and Coroutines

Ubiquitous multi-core processors with a significant increase in computing power resulted in an omnipresent expansion of concurrent server applications. However, modern multithreaded applications exposed a substantial number of efficiency-related challenges. Consequently, lightweight structured concu...

Celý popis

Uložené v:
Podrobná bibliografia
Vydané v:2022 45th Jubilee International Convention on Information, Communication and Electronic Technology (MIPRO) s. 1466 - 1471
Hlavní autori: Beronic, D., Modric, L., Mihaljevic, B., Radovan, A.
Médium: Konferenčný príspevok..
Jazyk:English
Vydavateľské údaje: Croatian Society MIPRO 23.05.2022
Predmet:
ISSN:2623-8764
On-line prístup:Získať plný text
Tagy: Pridať tag
Žiadne tagy, Buďte prvý, kto otaguje tento záznam!
Popis
Shrnutí:Ubiquitous multi-core processors with a significant increase in computing power resulted in an omnipresent expansion of concurrent server applications. However, modern multithreaded applications exposed a substantial number of efficiency-related challenges. Consequently, lightweight structured concurrency constructs emerged in various multithreaded applications, as the traditional heavyweight threads model is expensive in regards to memory due to its high dependency on OS kernel threads. Modern programming languages such as Kotlin and Java are both built on the Java Virtual Machine (JVM) and are commonly used in mobile application development and server-side applications, offering, by default, the traditional threads approach. However, Kotlin also includes support for a lightweight concurrency model with coroutines, while Java's virtual threads, announced in the OpenJDK's Project Loom, are still experimental. Such contemporary concurrency implementations are primarily enabling an increase in application performance and efficiency. This paper presents an overview of different approaches to structured concurrency and explores their implementation in programming languages Java and Kotlin. It provides a comparative analysis of traditional threads with coroutines in Kotlin and virtual threads in Java. Based on the conducted testing using benchmarks, we analyzed their performance, described implementation differences, and explored their utilization possibilities and adaptation to real-world use-case scenarios.
ISSN:2623-8764
DOI:10.23919/MIPRO55190.2022.9803765