3 ms·
They said "Java alternative for green threads" so they're talking about not green threads.
by jayd16 7mo ago
They said "Java alternative for green threads" so they're talking about not green threads.
- antonvs 7mo agoWhat alternative would they be referring to? Green threads were only (re-)introduced to Java in version 21 in 2023. I think what they're trying to say is that Java's green thread implementation has special support for async I/O. Threads that block on I/O aren't polled for completion by the runtime, instead they use OS async features under the hood. This allows Java's green threads to compete performance-wise with async/await solutions, but with cleaner code that doesn't need colored functions. In older green thread implementations in other languages, I/O can actually cause significant CPU overhead due to polling threads that are blocked by I/O requests.