Skip to content

C/C++

I/O Multiplexing

Using multiple threads to handle concurrent requests is a straightforward approach, as demonstrated in Network I/O. However, this method has limitations. A process can only create a finite number of threads, and performance tends to degrade as more resources are allocated to create and manage threads. This includes maintaining their states and coordinating their execution, which is not efficient. This approach can probably handle 1000 concurrent requests, but not much more. Let's discuss alternative methods, such as select, poll, and epoll.

Network I/O

Whether it's loading a webpage, sending a message that goes unanswered, or streaming a cat video, the network is at work behind the scenes. In essence, a network enables data transfer from one place to another, no matter the distance. At a technical level, this is achieved through two sockets communicating with each other. In this post, we'll explore how it works and implement a basic client-server communication using TCP sockets.