Software → Programming
Event Loop
A runtime mechanism that waits for events and dispatches callbacks or tasks without blocking the main execution flow.
Motivation
Event loop solves the problem of handling many waiting operations with a small number of threads.
Where it fits
Event Loop belongs to runtime systems and asynchronous programming.
Mental model
An event loop repeatedly picks ready events or callbacks and runs them without blocking on every I/O operation.
Common mistakes
- Blocking the event loop with CPU-heavy work.
- Assuming async code automatically runs in parallel.
Related concepts
Event Loop connects to asynchronous programming, non-blocking I/O, callback, promise, and concurrency.