今日问题: 0.1ms socket a 过来一起个请求 a 0.2ms socket b 过来一起个请求 b epoll_wait 返回结果是什么 我不懂epoll原理呀 不知道如果回答 和ET有关系吗?
1 ET方式什么情况下进行下次能触发
当前socket的缓冲区 可读如果做(你发送过来数据起我完全读完) 可写如何做(我这次发送数据必须发送完毕)
2 为什么ET一般采用 非舒塞模式
在epoll_wait返回之后为了满足上面#1要求 必须读完或者写完,不然就就阻塞哪里 影响其他业务
3 If more than one event occurs between epoll_wait(2) calls, are they combined or reported separately?
A7 They will be combined. 在epoll_wait返回之后 处理业务期间 之后会触发的将会合并
4 如何解决业务处理时间长导致 看Q9 Do I need to continuously read/write a file descriptor until EAGAIN when using the EPOLLET flag (edge-trig- gered behavior) ?
epoll - I/O event notification facility
epoll is a variant of poll(2) that can be used either as an edge-triggered or a level-triggered interface and scales well to large numbers of watched file descriptors.
suggested way to use epoll as an edge-triggered (EPOLLET) interface is as follows: i with non-blocking file descriptors; and ii by waiting for an event only after read(2) or write(2) return EAGAIN.
有个各种可能
1 如果 epoll_wait触发一次,在处理业务中, 然后请求a,b 最终一块返回 2 2 如果请求a触发了一次, epoll返回1, 然后在返回1 3 如果在read中 处理a有问题 可能后面就不在触发了了 上面提问有问题 没有正确答案