Sunday, November 2, 2014

poll() and select() Comparison

(1) poll does not require the user to calculate and pass in the highest fd + 1 as one of the parameter.
(2) select() need to manage the fds bitmask which has a length dependent on the fd number (e.g. 1000) and the bit mask may be sparse if only a few fd to watch.  so poll is more efficient as the list of fd depend on the number of fd to watch and not on fd number
(3) select() modify the fdslist upon return.  poll() use a separate event lists
(4) select() is more portable and some systems do not support poll()
(5) select() timeout has higher resolution (microsecond vs millisecond) than poll()



No comments: