๐—ง๐—ต๐—ฒ ๐˜€๐—ฒ๐˜๐—ง๐—ถ๐—บ๐—ฒ๐—ผ๐˜‚๐˜ ๐—ฅ๐—ฎ๐—ฏ๐—ฏ๐—ถ๐˜ ๐—›๐—ผ๐—น๐—ฒ

JS is single-threaded. It handles many tasks at once. You do this with a scheduler.

A JS scheduler uses the event loop. It pushes work to the back of the line. Your main thread stays free.

Node.js has its own scheduler. It uses libuv. Libuv manages files and networks.

Libuv talks to the OS. Linux uses epoll. Mac uses kqueue. These tools handle IO without blocking.

The OS is the final scheduler. It manages your CPU and disk.

Performance is not only about parallelism. Bad abstractions make you want more threads. A single thread often wins.

Source: https://dev.to/jeffrey_riggle_e261fba011/the-settimeout-rabbit-hole-5ff4