Motive
For Javascript and node.js, I am trying to understand the difference between the thread pool and Web API.
What I Currently Understand
- Thread pool: a multi-thread platform, where each thread executes their own operation.
- Web API: an API built in to the browser. It is part of the event loop, along with the call stack and callback queue to enable asynchronous operations in Javascript.
What I Am Confused about
It seems like both the thread pool, and Web API, enable Javascript to handle asynchronous behavior.
When Javascript is executing code off the singly-threaded call stack, is it sent to the Web API, which uses a thread pool to create a single thread for each asynchronous operation?
If not, how does the Web API and thread pool work together to give Javascript asynchronous capabilities?