← Back to context

Comment by dwattttt

1 day ago

Yes, in implementation they are not. I'm curious what the difference in subjective experience is.

Green threads don’t allocate stack frames and do not require such a massive context switch, which in turn allows for many more threads.

  • But if you happen to call a blocking syscall everything breaks.

    • That is not true of preemptive green threading systems. Go/Erlang/Haskell all run native foreign code on its own threads, and manage all internal I/O with async schedulers that never block. They also preempt user code in tight loops.

      Those are the only mature languages that have all of these features.

      1 reply →

    • That's why higher level languages are in an advantage. E.g. in java - outside of FFI - syscalls are basically "only within" standard library functions. So it was possible to make them virtual thread aware, e.g. park a virt thread, use something like io uring for the actual IO call on the JVM level and resume it when it returns, doing work on another virt thread in the meanwhile.