In programming, an asynchronous model essentially allows multiple things to happen at the same time. An action causes a “split” in the timeline, such that when a program initiates an action, it continues running while the action also runs with it. Contrast this with synchronous programming, where if a function takes a long time to evaluate, the program stops for the time the action takes and only returns when the action is finished.

This is good for long-running operations that take a long time to finish.

There’s two main types of asynchronous programming: events and threads. Events are notifications or signals that the action uses to notify the program when finished. Multithreading uses independent sequences of instructions executed concurrently — but this isn’t trivial task because it’s hard to understand what a program is doing when it’s doing multiple things at once.

JavaScript uses events, while languages like Rust use threads.

See this diagram below:1

Sub-pages

Footnotes

  1. From Eloquent JavaScript, by Marijn Haverbeke.