3 ms·
> With node, any IO is moved to a new thread Not quite (or somewhat): the IO is done asynchronously. You tell the kernel to notify you when any of a set of FD
by frutiger 8y ago
> With node, any IO is moved to a new thread
Not quite (or somewhat): the IO is done asynchronously. You tell the kernel to notify you when any of a set of FDs are ready for reading/writing, and it resumes you when that is so.
- hajile 8y agoMy understanding is that libuv creates a threadpool that it uses for IO operations and these inform the main thread when an IO event is ready. Is there something wrong with my understanding?
- frutiger 8y agoYes there is something wrong with your understanding. I recommend reading epoll(1) or kqueue(1).
- spiralx 8y agoYou're both right, although you more than the other guy being a dick. libuv uses a thread pool for asynchronous I/O for everything but network requests, which are handled on the main thread - presumably because they're already asynchronous by nature. http://docs.libuv.org/en/v1.x/design.html http://docs.libuv.org/en/v1.x/design.html