Java Virtual Threads Preview
There is a spectrum of solutions for dealing with slow I/O in programming languages (well, <i>all</i> I/O is best assumed to be slow I/O).  At the two ends of the spectrum are:<p>- continuation-passing style (CPS), hand-coded or compiler<p>- preemptive threading / processes<p>In between lie various solutions, like async/await (closer to CPS), and green threads (closer to preemptive threading).<p>The key difference between the two ends of this spectrum is memory footprint.  With CPS you manually compress state into tuned structures.  With threads you store state all over the stack in very inefficient ways because all those stack frames take extra space.<p>Any solution towards the thread side of the spectrum will yield significantly larger memory footprints than solutions towards the CPS side of the spectrum.<p>On the other hand, solutions towards the CPS side of the spectrum can require writing application-specific schedulers if fairness issues arise.<p>On the whole, solutions on the CPS side of the spectrum are better, IMO.<p>Java is kinda stuck with threads, so green threads make some sense.  Of course, you can get pathological issues in M:N threading, so be careful about that.