Sophie Hu wrote: > I see, so the complexity of both select() and FD_ISSET is: O(FD_SETSIZE) > and the times we use FD_ISSET() to check if a socket is bitmasked in fd_set > or not depends on number of sockets we want to check. > Correct.
/dev/poll, like event ports, also scales with the number of active descriptors (those which are actually ready) rather than the total number of registered descriptors, but using it in a multi-threaded application requires explicit locking, while event ports don't necessarily impose that constraint. (Your application might need to lock anyway, depending on what you're doing with each event, but you might be able to do more fine-grained synchronization with event ports.) A few years ago I generated some graphs from libevent's benchmarks that show these differences: http://blogs.sun.com/dap/entry/event_ports_and_performance_take (Libevent is a cross-platform library that solves this problem using the "best" solution on each platform.) --Dave -- David Pacheco, Fishworks _______________________________________________ perf-discuss mailing list perf-discuss@opensolaris.org