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...

Full description

Saved in:
Bibliographic Details
Published in:2022 45th Jubilee International Convention on Information, Communication and Electronic Technology (MIPRO) pp. 1466 - 1471
Main Authors: Beronic, D., Modric, L., Mihaljevic, B., Radovan, A.
Format: Conference Proceeding
Language:English
Published: Croatian Society MIPRO 23.05.2022
Subjects:
ISSN:2623-8764
Online Access:Get full text
Tags: Add Tag
No Tags, Be the first to tag this record!
Description
Summary: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