I was under the impression that I/O in node (in particular fs
's file I/O) is carried out by using native async (i.e., event-based) APIs of the operating system. However the following comment (taken from https://nodejs.org/api/fs.html#threadpool-usage) suggests otherwise:
The promise APIs use the underlying Node.js threadpool to perform file system operations off the event loop thread. These operations are not synchronized or threadsafe. Care must be taken when performing multiple concurrent modifications on the same file or data corruption may occur.
The quoted text brings the following hypothesis: fs
uses a blocking I/O API of the operating system (hence the need for a thread-pool), which, in turn, raises this concern/question:
In node can an I/O-intensive program get blocked/timeout/error-out due to lack of enough threads?