News for hackers. Stuff that matters.
Re:Java 21 Released by zerr on Tuesday September 19, 2023 @11:10AM (#37571032)
I remember they were talking about Green Threads 20 years ago. Is it something new?
Re:Java 21 Released by pjmlp on Tuesday September 19, 2023 @11:13AM (#37571080)
Yes, while green and red threads were an implementation detail not exposed to Java programmers, now both thread models are exposed (Threads and Virtual Threads).

Additionally since virtual threads are exposed across the whole runtime and standard library, not only they are built on top of native threads (red), the developers have control over their scheduling.

Re:Java 21 Released by kaba0 on Tuesday September 19, 2023 @11:17AM (#37571130)
Yes - green threads at the time were basically a solution to a hardware limitation.

Virtual threads make blocking IO calls automagically non-blocking, allowing for better utilization of the CPU.