Chapter 2
Why is asynchronous programming more efficient at handling I/O concurrency than multiple processes/threads?
Asynchronous programming is a very effective solution when dealing with I/O concurrency because it allows us to multiplex I/O actions without memory or computing overhead. Alternative solutions that are based on multithreading or multiprocesses require either more CPU either more memory, or even both.
Multithreading hits a limit when 1,000 threads are running concurrently. On heavy workloads, this puts some pressure on the OS scheduler and ends up wasting a lot of CPU resources due to contention.
Multiprocess solutions face the same problem, but also require more memory because the address space of the program is allocated ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access