javascript - Are there significant differences between the chrome browser event loop versus the node event loop? -


philip roberts brilliant job explaining browser event loop here providing clear explanation between call stack, event loop, task queue, , "outside" threads webapis. question these parallel equivalent components in node event loop , called same thing. is, when make call using node's file , web i/o libraries, these things happen outside stack callbacks queued in task queue?

...when make call using node's file , web i/o libraries, these things happen outside stack callbacks queued in task queue?

yes, absolutely; they're asynchronous ajax , settimeout asynchronous. perform operation outside of call stack, , when they've finished operation, add event queue processed event loop.

node's api provides kind of asynchronous no-op, setimmediate. function, "some operation" i've mention above "do nothing", after item added end of event queue.

there more powerful process.nexttick adds event front of event queue, cutting in line , making other queued events wait. if called recursively, can cause prolonged delay other events (until reaching maxtickdepth).


Comments

Popular posts from this blog

Unable to open serial port using Putty to bluetooth device on windows 7 64 bit -

bash - How do you programmatically add a bats test? -

java - Getting exception in JDBC thin driver -