Overview
This article is Part 8 of the series Working With NodeJS, a series of article to help simplify working with Node.js. In this article I will briefly cover what Node.js is and what it is not.
What is Node.js
Node.js is an open source cross-platform JavaScript runtime environment. It uses Chromes v8 engine, which is written in C++, to execute our JavaScript code in our applications on the platform of choice, as well as translate our JavaScript code into C++ code. Because chrome's v8 engine cannot interact with the filesystem or operating system, v8 must translate our JavaScript code so that C++ code can understand it which can interact with the filesystem and operating system. Node.js also uses the Libuv project, written in C, which provides The Event Loop. The Event Loop is like a scheduler that manages all asynchronous operations within our JavaScript program. When you start a Node.js program a single instance of The Event Loop is created and placed into a single thread. This means that our program runs on one core of the CPU. Node.js is not entirely single threaded. There are functions utilized within the Node.js library that run outside The Event Loop thus creating and using additional threads. You can manage the amount of threads available for these functions with the process.env.UV_THREADPOOL_SIZE
. The default number of threads available is 4.
Top comments (0)