Which part of syntax provides the information that this function should run in other thread and be non-blocking?
Let\'s consider simple asynchronous I/O in node.js>
A callback is not necessarily asynchronous. Execution depends entirely on how fs.readFile
decides to treat the function parameter.
In JavaScript, you can execute a function asynchronously using for example setTimeout.
Discussion and resources:
How does node.js implement non-blocking I/O?
Concurrency model and Event Loop
Wikipedia:
There are two types of callbacks, differing in how they control data flow at runtime: blocking callbacks (also known as synchronous callbacks or just callbacks) and deferred callbacks (also known as asynchronous callbacks).