- Node.js is a JavaScript runtime built on Chrome's V8
- Node.js uses an event-driven, non-blocking I / O model (event-driven model and IO)
Non-blocking I / O (Input / Ouput)
- Blocking I / O: I / O process to sleep when waiting for I / O to complete the next step after
- Non-blocking I / O: When I / O functions return immediately, without waiting for the process I / O completion
Question: All the instructions can be understood as blocking, on the implementation of a complete implementation of a lower order, why just come up with the IO?
Simply put, the instructions are dependent on CPU operation, when the CPU speed quickly, can execute 31 instructions, non-IO operations do not feel (the speed of the copy of the film) less than the blocking process
Notify the main program after the end of the IO -------> Event Driven
Event-driven
- After the I / O operations such as asynchronous notification primary process
- Observer Pattern