Nodejs event loop

problem description

The

nodejs event loop is executing the callback function. When a request comes suddenly, how does nodejs run? one of the two threads executes the fallback function and the other processes the request? Or the callback function that is being executed stops to process the request and executes the original callback function

Jun.17,2022
The

request comes suddenly, and the request will be placed in the callback queue, and the currently executing callback will not be affected. When the callback is completed, the callback

< hr class= "callback" >

will execute all the non-asynchronous code in the "executing callback function" first. The code for
nodejs is executed in a single thread. There is no case where two pieces of code are executed at the same time.


will not stop. The js execution environment of nodejs is single-threaded. All functions waiting for execution will be added to the execution queue to be executed in turn, and the next one will be replaced after the previous one has been executed. If the previous method has been executed all the time, theoretically, the later method will never be executed.


determine the order at the beginning of the next event loop.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b371b9-4d706.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b371b9-4d706.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?