Skip to content

Commit f6b237f

Browse files
author
Dane Springmeyer
committed
rework node related glossary updates
1 parent bf8a9ff commit f6b237f

2 files changed

Lines changed: 28 additions & 27 deletions

File tree

glossary.md

Lines changed: 27 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,12 @@ To know the exit code of a signal you add the `<signal id> + 128`. You can find
248248

249249
More info at <https://en.wikipedia.org/wiki/Unix_signal>
250250

251+
### I/O
252+
253+
An I/O operation that "calls out" from the process to the underlying system. For example, accessing the file system, reading/writing to memory, or sending something over the network
254+
255+
I/O stands for "input/output".
256+
251257
### crash
252258

253259
A crash is a general term to describe when execution of the program exits in an unintended and unrecoverable way. There are a variety of reasons a program may crash, ranging from a bug that created a fatal error condition to another program killing your program. Each crash can be described by one of a known set of [signals](#signal) which map to a return code.
@@ -1436,51 +1442,46 @@ Often static is used in combination with [constexpr](#constexpr) to ask for a va
14361442

14371443
### Node
14381444

1439-
A command line tool that consists of a set of bindings to V8 Javascript. These bindings allow you to use Javascript for implementing "lower-level" operations like working with the file system, threads, and scripting servers. More specifically, Node allows you to interact with the [POSIX api](#posix) (and POSIX-like api for Windows), using Javascript.
1440-
1441-
Node is made up of a combination of parts:
1445+
Node.js is a JavaScript runtime built on Chrome's [V8](#v8) JavaScript engine.
14421446

1443-
- V8: to interpret Javscript
1444-
- C++ Node bindings: Expose the low-level interface to non-blocking POSIX calls
1445-
- Threadpool: To do [file I/O](https://github.com/mapbox/cpp/blob/master/glossary.md#io) or any other blocking system call
1446-
- Event Loop: A main process (or main thread) that responds to an event queue: grabs the top item in the event queue, executes it, and then grabs the next item.
1447-
- Threadpool and Event Loop Manager ([libuv](http://libuv.org/)): This library helps manage the threadpool and event loop, and helps handle asynchronous [I/O operations](https://github.com/mapbox/cpp/blob/master/glossary.md#io).
1447+
It is a command line tool that can execute Javascript files and C++ code compiled as [a node addon](#node-addon).
14481448

1449-
See these articles to understand more about node [performance](#performance):
1449+
Node builds on top of [V8](#v8) by providing ways to do evented, non-blocking [I/O](#io). What this means in practice is that node runs your code on an [event loop](#event-loop) and provides an API for deferring work through asynchronous function callbacks which execute in a [threadpool](#node-threadpool). This "work" might be traditional [I/O](#io) like accessing the filesystem or a data on a network, or it could be any kind of intensive computations.
14501450

1451-
- <https://www.dynatrace.com/blog/how-to-track-down-cpu-issues-in-node-js/>
1452-
- <https://www.dynatrace.com/blog/understanding-garbage-collection-and-hunting-memory-leaks-in-node-js/>
1451+
This functionality in node is internally using a C library called [libuv](#libuv).
14531452

14541453
### V8
14551454

1456-
V8 is a Javascript "engine", or a Javascript interpreter. It translates Javascript into more efficient machine code (native assembly code), then executes it. V8 gives developers access to functionality (networking, DOM handling, external events, HTML5 video, canvas and data storage) needed to control the web browser, and access to server-side/system functionality within Node.js. V8 is [open source and written in C++](https://github.com/v8/v8).
1455+
V8 is a Javascript "engine", or a Javascript interpreter. It translates Javascript into more efficient machine code (native assembly code), then executes it. V8 gives developers access to functionality (networking, DOM handling, external events, HTML5 video, canvas and data storage) needed to control the web browser. V8 does not allow access to the filesystem (or provide other features you'd normally associate with a scripting language used on the serverside). Therefore [Node](#node) implements features like filesystem access on top of V8.
1456+
1457+
V8 is [open source and written in C++](https://github.com/v8/v8).
14571458

14581459
### Node Addon
14591460

1460-
See [node addon docs](https://github.com/mapbox/cpp/blob/master/node-cpp.md)
1461+
Node provides some "addons" built in, like the `zlib` module, which is implemented [in C++ inside node core](https://github.com/nodejs/node/blob/df63e534584a54dcf02b37446e1e821382e3cef3/src/node_zlib.cc).
14611462

1462-
### event loop
1463+
You can also write your own [a node addon](#node-addon) and include it dynamically within your application. If you write a [node addon](#node-addon) you can get access to all lower-level operations available in C++ like like working with threads and custom memory allocation.
14631464

1464-
TODO
1465+
See [node addon docs for more details](https://github.com/mapbox/cpp/blob/master/node-cpp.md)
14651466

1466-
### libuv
1467+
### Event loop
14671468

1468-
A library that handles threadpool, event loop, and uses the threading implementation native to the given operating system (for example: Unix uses `pthread`). It is open source, written in C, and is a standalone library most useful as a multithreading interface. Before libuv was available, developers had to manually manage and write threads based on what was provided by the operating system.
1469+
The event loop is what allows Node.js to perform non-blocking [I/O](#io) operations — despite the fact that JavaScript is single-threaded — by offloading operations to the system kernel whenever possible.
14691470

1470-
Libuv stands for "lib-ultra-event".
1471+
The event loop runs in the main process (or main thread) and responds to an event queue: grabs the top item in the event queue, executes it, and then grabs the next item.
14711472

1472-
### I/O
1473+
Learn more at <https://nodejs.org/en/docs/guides/event-loop-timers-and-nexttick>
14731474

1474-
An I/O operation that "calls out" from the process to the underlying system. For example, accessing the file system, reading/writing to memory, or sending something over the network
1475+
### Threadpool
14751476

1476-
I/O stands for "input/output".
1477+
In Node.js this is a queue of threads - of fixed size - that are launched at started and ready to execute work.
14771478

1478-
### threadpool
1479+
To learn how to control the threadpool size with `UV_THREADPOOL_SIZE` and much more see the [node addon docs](https://github.com/mapbox/cpp/blob/master/node-cpp.md)
14791480

1480-
### worker
1481+
### libuv
14811482

1482-
### C++ bindings
1483+
A library that provides a cross-platform API for asynchronous [I/O](#io). Most importantly libuv provides access, for [node addons](#node-addon), to the [Node Threadpool](#node-threadpool).
14831484

1484-
### non-blocking/blocking
1485+
Libuv stands for "lib-ultra-event" and [is open source and written in C](http://libuv.org)
14851486

1486-
### [NAN](https://github.com/mapbox/cpp/blob/master/node-cpp.md#native-abstractions-for-nodejs-nan)
1487+
See [node addon docs for more details](https://github.com/mapbox/cpp/blob/master/node-cpp.md)

node-cpp.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ A Node.js addon is still a Node module. Users still interact with it as if they
8787

8888
To swing between Node and C++, the Node community maintains a project called [_NAN_](https://github.com/nodejs/nan) (Native Abstractions for Node.js) that simplifies running different versions of Node and, subsequently, v8. NAN is a header-only C++ library that provides a set of Macros for developing Node.js addons. Check out the [usage](https://github.com/nodejs/nan#usage) guidelines.
8989

90-
More examples of how to port C++ libraries to node can be found at [nodejs.org/api/addons](http://nodejs.org/api/addons.html). See https://nodesource.com/blog/c-add-ons-for-nodejs-v4/ for a detailed summary of the origins of Nan. And see http://blog.reverberate.org/2016/10/17/native-extensions-memory-management-part2-javascript-v8.html for a good introduction to v8 that is not specific to node.js.
90+
More examples of how to port C++ libraries to node can be found at [nodejs.org/api/addons](https://nodejs.org/api/addons.html). See https://nodesource.com/blog/c-add-ons-for-nodejs-v4/ for a detailed summary of the origins of Nan. And see http://blog.reverberate.org/2016/10/17/native-extensions-memory-management-part2-javascript-v8.html for a good introduction to v8 that is not specific to node.js.
9191

9292
### Examples
9393

0 commit comments

Comments
 (0)