Java Virtual Threads - How Virtual Threads Work, Scheduling, Cooperation and More

preview_player
Показать описание

This video is a comprehensive introduction to Java virtual threads, one of the most exciting changes in the JDK in years. With an intact Thread API, Java virtual threads can scale your application to millions of concurrent tasks running on a few platform/OS/JVM threads.

In this video you will learn
- what virtual threads are and how they work
- how to build virtual threads
- how blocking operations work
- how you can use ExecutorServices with virtual threads
- how cooperative scheduling work
- how virtual threads yield control over platform threads
- what configurations you can use to scale your concurrent applications

Follow Rock the JVM on:

-------------------------------------------------------------------------
-------------------------------------------------------------------------
Рекомендации по теме
Комментарии
Автор

It was great explanation about virtual threads.

MadeEasyTech
Автор

I feel bad for making 42 views into 43. Did I just change the meaningOfLife?

rekonn
Автор

This is really advances stuff. Do you intent to do a video that starts from Threads basics walking right up to advanced stuff like this?

bobyrasta
Автор

is Go and Rust Tokio channel equivalent available in Java VT?

taktak
Автор

Will there be a spring boot course? (it would be really interesting in the form of a full-fledged project with ui)

dangalimov
Автор

probably a dumb question but... when you submit something to a pool of threads like a ForkJoinPool, you are actually creating a "Task" which is going to be queued and handled by a thread when available, so in practice I don't see any advantage of using virtual threads since the "task" should be already lightweight, and the blocking should be also semantic, you don't block the thread of a pool, you just block a task. So long I don't use Java that when you wrote "var" I thought you were confusing Scala with Java xD

update: now I saw that you showed that virtual threads are implemented with a fork join pool o_O
so anything that can be implemented with virtual threads can be imlemented with a fork join pool with essentially the same behaviour and semantics in older version of java... is that correct.

leorandomnickname
Автор

I think it is the same as a green thread/fiber in Cat Effects?

scalacode
Автор

this is not how it works this is "how to use it"...

how it works would be : how does virtual thread carry around the stack, how does it work under the hood, how it identifies what is "blocking" etc etc...

krellin
Автор

I recon the point of having virtual threads is to not have a pool of them. You rather create a new VT for each task.

deadvatniks