Graphical representation of threads
06/16/2025

Virtual Threads in Java

Montevideo, June 16, 2025.

In this article, Sofis Solutions analyzes the advantages and impact of Virtual Threads introduced in Java JEP 444. This new model allows creating lightweight and highly efficient threads, managed directly by the Java Virtual Machine (JVM), representing a significant change compared to traditional threads.


Every day, applications need to process larger amounts of data simultaneously and efficiently. Java has been aware of this need since its earliest versions, implementing the use of threads to execute tasks concurrently according to the number of processors available in the CPU. However, traditional threads are costly resources: each consumes memory for its stack and depends on the operating system for scheduling, which can lead to blocking and low scalability. To mitigate this, techniques like thread pools were adopted, where developers had to manage their creation, reuse, and synchronization, adding complexity to applications.

Starting with Java 19 as a preview, and stable in Java 21, a new model called Virtual Threads (JEP 444) is introduced. This approach proposes that the JVM, rather than the operating system, manages the lifecycle of threads. This removes direct dependency on operating system resources, allowing millions of lightweight threads to be created that do not block physical resources while waiting.

In simple terms, a Virtual Thread is a Java thread managed by the JVM that decouples from the operating system thread during waiting periods (e.g., a blocking I/O operation). This allows many virtual threads to share a reduced number of platform threads, achieving much greater scalability with less effort. Additionally, the traditional programming model with Runnable is maintained, allowing existing code to migrate without major refactoring.

Creating a virtual thread (Virtual Thread) is as simple as shown below:

Runnable task = () -> System.out.println("Running on: " + Thread.currentThread()); Thread.startVirtualThread(task); 

This snippet launches a concurrent task using a Virtual Thread, something that in previous versions required more configuration and manual management. Internally, the JVM handles all orchestration, freeing the developer from worrying about low-level details.

Virtual Threads significantly improve the way we program concurrent tasks in Java. The model is lighter, easier to use, and promises superior performance in highly concurrent applications. There is still work to be done, especially in adapting libraries that internally manage their own threads, but the direction is clear: Java is moving toward a simpler and more powerful concurrency model, ready for the challenges of modern software.

Latest news
The image shows a business and technology collage with a handshake in the center, symbolizing strategic alliances, innovation, and digital transformation.
08/18/2025
Commitment to the Global Compact Strategy 2024–2025

Within the framework of the United Nations Global Compact's 2024–2025 strategy, which proposes five transformative changes to accelerate business impa...

The image shows a digital interface with data analysis panels, artificial intelligence and graphics,
08/15/2025
Boosting CRM with Biona Search: Conversational intelligence to transform data into decisions

En muchas organizaciones, el CRM (Customer Relationship Management) es el núcleo operativo de la relación con los clientes. Sin embargo, acceder a la ......

person interacting with digital interfaces representing artificial intelligence, data, and programming
08/07/2025
CAROSAI, Audit and Digital Transformation

In May 2025, Sofis Solutions participated in the 13th CAROSAI Congress in the Bahamas, a key meeting for strengthening public auditing in the Caribbea...