logoalt Hacker News

pdimitaryesterday at 10:40 PM2 repliesview on HN

If they are, I have not heard about it (which does not mean much, I check Java once a year). And if they really are then I'd give Java a serious look again because it's a mature ecosystem that was gimped by ancient runtime decisions for literal decades.


Replies

cogman10yesterday at 11:37 PM

As of Java 24 (Java 25 being an LTS) I'd say they are equivalent. You can use a virtual thread just like you use a regular thread and there's basically no handicaps or gotchas. In Java 21, when they were released, there is a gotcha that the pretty normal use of the `synchronized` keyword would pin a "carrier thread" which ends up blocking all virtual threads from running on that carrier thread.

Pinning can still happen in some much more rare cases, same with go. For example, FFI.

The memory usage, performance, etc are all go like. You can spawn millions of virtual threads with hardly and memory requirements and without overburdening the OS with context switches. The JVM also enjoys faster GC performance with virtual threads.

show 1 reply
vips7Ltoday at 3:51 AM

Your knowledge is outdated. Go check again.