Slide 12
Slide 12 text
Copyright © ONE CAREER Inc. All Rights Reserved.
How to solve the thread blocking problem?
→ Separate synchronous and asynchronous tasks execution.
JS single thread and Async task
12
● Synchronous task
○ put them into the JS engine immediately, execute them, and wait for results on the fly.
● Asynchronous task
○ give them to the browser or node first, no need to wait. When the JS thread is free,
functions from the task queue will be picked and executed.
It may be hard to understand with just text, so let's do SIMULATION!