Java Virtual Threads

preview_player
Показать описание
Java Virtual Threads are a new kind of lightweight threads that were added to Java in Java 19. In this video I describe what Java virtual threads are, how virtual threads are different from the existing platform threads, and show you a quick example of how to use virtual threads.

Twitter: @jjenkov

Java Virtual Threads - Text version:

Java ExecutorService Using Virtual Threads Internally:

Java Concurrency Playlist:

Java Concurrency Tutorials:
Рекомендации по теме
Комментарии
Автор

God of Concurency..i have bene flowing you since my 2014 when you used to write blog post only...by going through your post i attend interview like a LION when they ask mutithreading qns...Thanks a Lot form 10+ yrs exp guy from BLR, India.

shubhamagarwal
Автор

you are my go to person while brushing threading concepts

amitbhattacharyya
Автор

My thread concepts are clear just because of you. I always ask my juniors to refer your articles for threads. And now these virtual threads. Thanks for sharing knowledge 👍

umeshgkamat
Автор

Just want to say thank you. Your guides ones of the best guides I watched

dynamite-san
Автор

You're making so much for the java community. Thank you so much!

eq
Автор

Jakob you deserve more exposure and subscriber. Your materials and lectures are very organized and structured!!! You taught way better than UC professor!

lnursalim
Автор

Very well explained with a nice demo, thanks

__idan__
Автор

Feels like a multi threading Thread.
Like assigning a Thread to do multi threading work.
Thank you for your tutorials, they are awesome!

eimaisklhros
Автор

This is great, learnt something new today. Thanks for sharing!

shaikzakirhussain
Автор

Thanks Jakob, It seems this concept is much more similar to ThreadPool in C#

VikramSingh-wymn
Автор

wow this is the best channel for java developers, great job

josemiguelhpz
Автор

Thank you very much!, you explain very well. subscribed!

slim_mike
Автор

I am a bit lost. Platform threads use OS threads . OS thread would run on the CPU if it is executes 100% CPU code, if it is blocked, my assumption was the OS would execute another thread/program on the CPU, so ultimately the OS takes care of ensuring the CPU is well utilized? like ultimately the CPU is not blocked coz the the thread is waiting for a IO or network operation. Could you please throw some light on the lifecycle of an OS/platform thread? the advantage I see here is the light weightedness of virtual thread, so when a virtual thread is blocked for a time taking operation, another virtual thread can run on the CPU but the memory footprint of platform thread is not required. Also, a machine has many programs running, each program has threads (atleast 1). So why are platform threads restricted to the number of cores?

madhaviwagle
Автор

It looks like virtual threads will not be a preview feature, but will be finialised in java version 21.

Anthony-
Автор

Very well explained. Thank you! But how many real threads are being used while creating the 100_000 virtual threads? Does the JVM automatically select the number or it is something the developer can adjust?

DavidSoles
Автор

Hi, are these virtual Threads part of the "Platform Looms" that u described in previous videos?

ruchitadhunna
Автор

In the last example since there are no blocking I/O, why don't those virtual threads execute in the same order as they start?

armany
Автор

hey Jakob. many thanks for this tutorial. Is it possible to create virtual threads without using Project LOOM?

adithyakamath
Автор

unable to see preview version 19 even after setting sdk to jdk 21 or 23 downlaoded an set from lombook

bitbeee
Автор

Thread dump, deadlocks, shared resources, limits

nissi