Where is the time between the execution of the js asynchronous task and the call back function?

recently, I have been studying event loop . I have read a lot of articles written by my predecessors, who said that when the main thread executes an asynchronous task, it initiates a call, then suspends it, and when it has a return value, it is placed in the task queue to wait for the main thread to call the callback function to get the return value.
but I don"t understand how to hang it. When the main thread performs another task when it is suspended, what is the suspended asynchronous task doing? Where?
such as ajax request, don"t you need a thread to run it when receiving data from the server?
is there anything my brother knows? Solve.

Mar.14,2021

    When the
  1. main thread executes the asynchronous call, it hangs the asynchronous code on the asynchronous thread provided by the browser kernel to execute, while the main thread continues to execute the Synchronize code.
  2. the callback is placed in the message queue after the asynchronous thread finishes execution.
  3. the main thread pass takes an asynchronous callback from the message queue through an event loop and then executes it.

such as an ajax request.
when the js engine executes the ajax request, the browser opens a new thread to execute the XMLHttpRequest, while the main thread provided by the js engine loops through the message queue to find the callback to execute.

answer the questions based on personal understanding. If there are any mistakes, please point them out directly and do not hesitate to give us advice.


this should involve the concept of an "event-triggered thread".
it is recommended to read from browser multi-process to JS single thread, the most comprehensive comb of JS running mechanism
may solve your doubts.

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-1b3c2ee-2c2d4.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-1b3c2ee-2c2d4.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?