Java Virtual Threads
Discussions center on Java's virtual threads via Project Loom, comparing them to green threads in Haskell, Go goroutines, and async/await models, debating their advantages, implementation details, and use cases over traditional threads.
Activity Over Time
Top Contributors
Keywords
Sample Comments
Haskell has green threads. Plus nowadays Java also has virtual threads.
Seems java's virtual thread is the only sane async model out there.
Are there still legitimate use cases of using real threads vs virtual threads?
That's why green threads and fibers exist. Green threads implementation of Java has been removed a long time ago, but there's Project Loom: https://developers.redhat.com/blog/2019/06/19/project-loom-l...
What patterns does async/await solve which virtual threads donβt?
What you propose is similar to how Java virtual threads work.
This is not news, it's documented in the official description of the virtual threads: https://openjdk.org/jeps/444
Virtual threads or green threads, etc., are all names for the same thing: stackful coroutines. I would say yes! If your language/platform/runtime supports them, that should definitely be your starting point.
Java's new philosophy (in "Loom" - in production OpenJDK now) seems to be virtual threads that are cheap and can therefore be plentiful compared to native threads. This allows you to write the code in the old way without programmer-visible async.
Out of curiosity, what's the difference between virtual threads, green threads and, say, goroutines?