The macro-task,micro-task event cycle combined with previous cognition (first Synchronize and then asynchronous) is out of order.

the previous cognition is: first execute the global function context to enter the function execution stack, then pop up the execution stack at the end of execution, and then go to the asynchronous message queue to get the message through the event loop, and then execute asynchronously. Then I saw this article https://www.jianshu.com/p/12b.

.

can I understand that asynchronous tasks are divided into macro tasks and micro tasks? Is there a boss who can thoroughly sort out the whole process and explain it?

Jun.25,2021

  • first of all, micro tasks and macro tasks are not directly related to Synchronize and async themselves
  • events loop in terms of cognition, I personally think that we should not confuse nodejs with browser
  • I probably scanned the analysis of a more complete example behind the middle. It is very detailed, but it looks a little tired. In the final analysis, I only need to remember two points:

    • Macro task means that I don't need to do a task now. Wait until next time it's my turn
    • .
    • microtask refers to a task that I can't do now. Wait until I finish the current task, and then do it when I have time
    • .
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-1b3fbe3-2c4c4.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-1b3fbe3-2c4c4.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?