You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: glossary.md
+27-26Lines changed: 27 additions & 26 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -248,6 +248,12 @@ To know the exit code of a signal you add the `<signal id> + 128`. You can find
248
248
249
249
More info at <https://en.wikipedia.org/wiki/Unix_signal>
250
250
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
+
251
257
### crash
252
258
253
259
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
1436
1442
1437
1443
### Node
1438
1444
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.
1442
1446
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).
1448
1448
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.
This functionality in node is internally using a C library called [libuv](#libuv).
1453
1452
1454
1453
### V8
1455
1454
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).
1457
1458
1458
1459
### Node Addon
1459
1460
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).
1461
1462
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.
1463
1464
1464
-
TODO
1465
+
See [node addon docs for more details](https://github.com/mapbox/cpp/blob/master/node-cpp.md)
1465
1466
1466
-
### libuv
1467
+
### Event loop
1467
1468
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.
1469
1470
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.
1471
1472
1472
-
### I/O
1473
+
Learn more at <https://nodejs.org/en/docs/guides/event-loop-timers-and-nexttick>
1473
1474
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
1475
1476
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.
1477
1478
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)
1479
1480
1480
-
### worker
1481
+
### libuv
1481
1482
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).
1483
1484
1484
-
### non-blocking/blocking
1485
+
Libuv stands for "lib-ultra-event" and [is open source and written in C](http://libuv.org)
Copy file name to clipboardExpand all lines: node-cpp.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -87,7 +87,7 @@ A Node.js addon is still a Node module. Users still interact with it as if they
87
87
88
88
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.
89
89
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.
0 commit comments