original text ：nodejs.org/en/docs/gui…
You should have some understanding of the concepts of blocking and non blocking ：
Just to be brief , Most of the blocking is due to synchronous mode , Non blocking can be understood as asynchronous mode processing some time-consuming operations
Then again Node.js How to describe blocking and non blocking in ？ The following is mainly about this problem ：
Node What's blocking in ？
I/O Operation can be understood as the interaction with the system disk （ Data reading and writing ） Or network requests, etc
Blocking is everything else JS Code execution has to wait until the previous time-consuming
I/O operation Or some network requests, etc . because Node There is an event loop to solve this problem , Let's say js In the process of re execution , The event loop has not been opened , In fact, it will cause congestion .
Node.js There are also some synchronization methods in the standard library of , Most of these methods are based on
libuv To achieve the blocking effect .Node There are also some blocking methods in the native module of . But at the same time Node The corresponding asynchronous version of API.
What's up? libuv Well ？ It's a multi platform, asynchronous I/O The library of operations . See the official website for details ：libuv.org/
Node What's non blocking in ？
First of all, think about not limited to Node How to achieve non blocking in the context of （ asynchronous ） Well ？
To put it simply, two ：
1） You can open multiple threads to handle concurrent operations
2） The pattern of the event cycle , If there are asynchronous operations in the event queue , After the end of the asynchronous operation , Call the corresponding callback function to process the asynchronous return result
V8`` engine To do the .
since JS The execution of is single threaded , Then we can't be JS During the process of interpretation and execution, open another thread to interpret and execute , therefore Node.js It's the second way to achieve non blocking （ Asynchronous operations ） Of .
Be careful not to mix Node Blocked and non-blocked API