1# Asynchronous operations
2
3Node.js native add-ons often need to execute long running tasks and to avoid
4blocking the **event loop** they have to run them asynchronously from the
5**event loop**.
6In the Node.js model of execution the event loop thread represents the thread
7where JavaScript code is executing. The Node.js guidance is to avoid blocking
8other work queued on the event loop thread. Therefore, we need to do this work on
9another thread.
10
11All this means that native add-ons need to leverage async helpers from libuv as
12part of their implementation. This allows them to schedule work to be executed
13asynchronously so that their methods can return in advance of the work being
14completed.
15
16Node Addon API provides an interface to support functions that cover
17the most common asynchronous use cases. There is an abstract classes to implement
18asynchronous operations:
19
20- **[`Napi::AsyncWorker`](async_worker.md)**
21
22This class helps manage asynchronous operations through an abstraction
23of the concept of moving data between the **event loop** and **worker threads**.
24
25Also, the above class may not be appropriate for every scenario. When using any
26other asynchronous mechanism, the following API is necessary to ensure an
27asynchronous operation is properly tracked by the runtime:
28
29- **[AsyncContext](async_context.md)**
30
31- **[CallbackScope](callback_scope.md)**
32