Hacker News new | ask | show | jobs
by benwilson-512 2805 days ago
In Erlang (and presumably Go) green threads end up in a waiting queue when waiting on further work to do, and as such don't need to be polled or consume any CPU at all while idle. It's only when they receive a message indicating more work can be done that they move into the work queue.
1 comments

I think the person you're replying to was saying that 'useful work' does not including waking up, reading one value, and then immediately sleeping again for another response. That's a big expensive context switch for really nothing very useful, and it could have waited until all inputs were ready and there was significant computation that could be run.
In most cases, BEAM's (the Erlang VM's) context switches are not big and expensive, though, which is something you get with user space threads.