Skip to content

Instantly share code, notes, and snippets.

@lovubuntu
Created August 26, 2019 05:14
Show Gist options
  • Save lovubuntu/bc1dc1b225a14b5f9cda23b2d59bd5f2 to your computer and use it in GitHub Desktop.
Save lovubuntu/bc1dc1b225a14b5f9cda23b2d59bd5f2 to your computer and use it in GitHub Desktop.
A peek under the hood of node.js

V8:

  • C++ library used by Node to provide its javascript implementation
  • It provides ways of creating objects and calling methods Libuv:
  • C library that implements Event loops, worker threads and its async behaviour
  • Brings in Cross platform capabilities for many common tasks
    • Interacting with Filesystem, Sockets, Timers, System Events
    • pthreads (POSIX thread, an execution model exists independently from a language) like implementation to handle tasks for addons that need to move beyond event loop to handle parallelisation
      • Addon authors are encouraged to avoid blocking IO operations or time intensive tasks (offloading to libuv async system operations, worker threads, or custom use of libuv threads) Internal Node.js libraries:
  • Node exports many C++ APIs which Addons can use (eg. node::ObjectWrap) Statically Linked Libraries:
  • Has many statically linked libraries like OpenSSL
  • OpenSSL, V8, libuv, zlib can be used by addons
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment