Node runtime
V8 Engine
The javascript runtime that interprets and executes the javascript code.
libuv
Operating System based layer like process, file-system and concurrency.
Node JS
Wrappers and interfaces for JS and C++ interfaces.
process.binding() -> connects js and c++ in node js \/ V8 engine \/ node c++ \/ libuv
Event Loop
Order of operations
- Time based operations - setTimeout, setInterval and setImmediate at the end of tick
- Os Tasks - Server listening to port
- Long running task - fs module operations.
Node tick
- Looks at the above queues
- Waits for the queues to have a task.
- Looks for setImmediate events
- Waits for close event
libuv
- libuv has 4 threads in its thread pool
- try running crypto example to use threads to validate this
- Delegates the http request handler to OS helper.
- Doesnt use thread pool necessarily.
Newsletter