The idea of single thread solving high concurrency is to adopt the idea of non-blocking, asynchronous programming. The simple generalization is that when encountering very time-consuming IO operations, the subsequent code is executed in a non-blocking manner, and the event loop is entered, and when the IO operation is complete, the program is notified that the IO operation is complete. The main use of JavaScript callback function to achieve.
Although multithreading can also solve high concurrency, but is to build multiple threads to implement, the disadvantage is that when encountering time-consuming IO operations, the current thread will be blocked, and the control of the CPU to other threads, the problem is to be very frequent thread context switch.
Since Nodejs is single-threaded, how does it handle multiple requests for high concurrency?