There is unlikely to be any performance difference that you notice.
Inside the kernel, select adds your thread to the wait queue for each descriptor you select on, and puts it into sleep mode. If you select n in descriptors, your thread will be added to the queue n wait. When something happens to the handle (for example, data arrives at the socket), all threads in the wait queue wake up.
Choosing a huge number of descriptors will add you to a huge number of waiting queues. After you wake up, your thread should be removed from all waiting queues, including those on which there was no activity. Thus, there may be a slight advantage on this side for waiting for a small set of descriptors in multiple threads, rather than in a huge set of descriptors in a single thread.
On the other hand, select itself requires the kernel to execute all possible descriptors in order to see which ones are members of your fd_set . So on this side, there might be a slight advantage to having only one thread calling select ...
In general, I would suggest that this is a wash.
If you intend to deal with a large number of descriptors, you are better off using a more scalable (albeit not portable) mechanism, such as epoll . With epoll several threads that handle the descriptor pool should scale very well.
source share