函数原型:
int select(int nfds,fd_set* readfds, fd_set* writefds,fd_set* exceptfds,struct timeval* timeout)
int poll(struct poll* fds,nfds_t nfds, int timeout)
int epoll_create(int size)
int epoll_ctl(int epfd, int op. int fd. struct epoll_event* event)
select 用户通过三个参数去传他们感兴趣的读写异常文件描述符集,由于内核会实时修改这些参数来反映文件描述符的就绪情况,所以用户每一次调用都必须重置这些参数,工作模式lt,轮询效率o(n)
poll统一处理所有事件,用户通过events来传入对文件描述符感兴趣的事件,内核通过reevent来反馈文件描述符的就绪情况,工作模式lt,轮询效率o(n)
epoll通过创建,注册的方式来管理文件描述符集,epoll_wait不需要每次调用都传入感兴趣的文件描述集,而仅用于内核反映文件描述符的就绪情况,工作模式可lt可et,轮询效率o(1)