5

Meaning the C10K problem, what is the best way to do asynch I/O on Mac OS X (assume to use on Mac and iPhone/iPad)?

On Linux our choice is epoll, on Windows is I/O Completion Ports.

Top priority is performance and scalability (thousands of connections).

UPDATE

OK. As Darwin is BSD-like system, my common idea is to use kqueue. Is this a right direction? It would be nice to hear from someone experienced in this area.

Thanks

4

2 回答 2

3

Boost.Asio是一个优秀的跨平台、高性能、C++ 网络库。在 Mac OS X 上,它使用 kqueue 作为 reactor 事件循环,其他平台使用 epoll、I/O 完成端口、poll 或 select。它可以扩展到数千个连接而不会出现问题。顾名思义,它通过使用前摄器设计模式进行并发而不使用线程来促进异步编程。

于 2011-05-15T01:07:48.343 回答
1

如果使用 libev,则可以在各种兼容的异步 IO 后端(epoll、kqueue、select 等)之间切换,而无需担心实现细节。

http://software.schmorp.de/pkg/libev.html

于 2011-05-14T23:34:55.923 回答