各个系统上的高效的 multiplex 方法,BSD 有 kqueu,Linux 有 epoll, Solaris 有 /dev/poll。此处 "高效" 是相对传统的 select/poll 说的。
一 :
Kqueue is a scalable event notification interface that first appeared in
FreeBSD 4.1
[...]
Some other operating systems which traditionally only supported select(2) and
poll(2) also currently provide more efficient polling alternatives, such as
epoll(7) on Linux and /dev/poll(4) on Solaris.
二 bind 的 configure --help:
--enable-kqueue use BSD kqueue when available [default=yes]
--enable-epoll use Linux epoll when available [default=auto]
--enable-devpoll use /dev/poll when available [default=yes]
三 源代码 bind-version/lib/isc/unix/socket.c:
/*%
* Choose the most preferable multiplex method.
*/
#ifdef ISC_PLATFORM_HAVEKQUEUE
#define USE_KQUEUE
#elif defined (ISC_PLATFORM_HAVEEPOLL)
#define USE_EPOLL
#elif defined (ISC_PLATFORM_HAVEDEVPOLL)
#define USE_DEVPOLL
typedef struct {
unsigned int want_read : 1,
want_write : 1;
} pollinfo_t;
#else
#define USE_SELECT
#endif /* ISC_PLATFORM_HAVEKQUEUE */转:http://blog.zhangsen.org/2010/10/various-multiplex-methods.html