> a single loop which blocks until the task yields while waiting on the result from one of the worker threads
Yes, node.js is cooperative, yet since all I/O is asynchronous the time spent blocking is mostly dispatching and simple operations, it doesn't block while waiting - that's where it's performance and high concurrency comes from. Doing CPU-heavy work in the server/main process is a no-no.
Obviously that approach is fine enough for many things. Before node.js, people have written those kinds of servers in Twisted or Netty, with great results. Netty based framework powers, for example, much of Twitter. I was just explaining how the scheduling works :)
Yes, node.js is cooperative, yet since all I/O is asynchronous the time spent blocking is mostly dispatching and simple operations, it doesn't block while waiting - that's where it's performance and high concurrency comes from. Doing CPU-heavy work in the server/main process is a no-no.