Live data from Hacker News

Virtual Threads Arrive in JDK 21, Ushering a New Era of Concurrency

infoq.com

1–10 of 555 posts

Re: Virtual Threads Arrive in JDK 21, Ushering a New Era of Concurrency

#3
post #2

Are these green threads? -- edit myself: no, it can't be. JVM had green threads since eons ago, according to wikipedia. -- edit again: this SO thread --pun intended!-- explains it https://stackoverflow.com/questions/74639116/what-is-the-dif...

Yes, these are user land threads. Sometimes they are also called fibers, green threads, virtual threads, or stackfull coroutines.

Re: Virtual Threads Arrive in JDK 21, Ushering a New Era of Concurrency

#6
post #2

Are these green threads? -- edit myself: no, it can't be. JVM had green threads since eons ago, according to wikipedia. -- edit again: this SO thread --pun intended!-- explains it https://stackoverflow.com/questions/74639116/what-is-the-dif...

That's pretty confusing without some more context, yeah. Not the best article in this regard.

> In fact, in very early Java versions, the JVM threads were multiplexed onto OS threads (also known as platform threads), in what were referred to as green threads because those earliest JVM implementations actually used only a single platform thread.

> However, this single platform thread practice died away around the Java 1.2 and Java 1.3 era (and slightly earlier on Sun’s Solaris OS). Modern Java versions running on mainstream OSs instead implement the rule that one Java thread equals exactly one OS thread.

https://blogs.oracle.com/javamagazine/post/going-inside-java...

Re: Virtual Threads Arrive in JDK 21, Ushering a New Era of Concurrency

#8
post #6
post #2

Are these green threads? -- edit myself: no, it can't be. JVM had green threads since eons ago, according to wikipedia. -- edit again: this SO thread --pun intended!-- explains it https://stackoverflow.com/questions/74639116/what-is-the-dif...

That's pretty confusing without some more context, yeah. Not the best article in this regard. > In fact, in very early Java versions, the JVM threads were multiplexed onto OS threads (also known as platform threads), in what were referred to as green threads because those earliest JVM implementations actually used only a single platform thread. > However, this single platform thread practice died away around the Java…

I found the StackOverflow accepted answer to be a very clear explanation, it summarizes and re-iterates what matters: "With Virtual Threads, multiple virtual threads can run on multiple native threads (n:m mapping)"

Re: Virtual Threads Arrive in JDK 21, Ushering a New Era of Concurrency

#10
So with this, the last thing Go had going for it over Java is gone, right?

Java has an obviously better type system, while Java originated the billion dollar mistake, Java also at this point has much better practices around handling nulls than Go, Java's jars are more portable than go's binaries, Java's GC performs better, Java has a more mature ecosystem and more libraries... Java has better IDE support and comparable compile times.

I guess at this point the only major difference is that you can teach a 3 year old to write Go more easily, so ChatGPT produces correct Go more easily than Java, and the dependency management story differs a little (though I don't think you can really call a winner or loser on that one, it's just different)

Post reply on HN