OS//concurrency//mutex//event loop
An event loop is a single-threaded concurrency model: one core runs a loop that dispatches callbacks when I/O operations complete, which avoids mutex contention entirely. JavaScript (Node.js, browsers), Python asyncio and Rust's tokio all use this pattern.
An event loop is a single-threaded concurrency model: one core runs a loop that dispatches callbacks when I/O operations complete, which avoids mutex contention entirely. JavaScript (Node.js, browsers), Python asyncio and Rust's tokio all use this pattern.
Non-blocking I/O calls (epoll, kqueue, IOCP) register interest, and the loop multiplexes thousands of concurrent connections without spawning threads. That makes it ideal for I/O-bound workloads, while CPU-bound tasks block the loop and must be offloaded. The async and await syntax that most languages put on top of it is described in asynchronous programming.