简体   繁体   English

Mac OS X上的异步I / O.

[英]Asynchronous I/O on Mac OS X

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)? 这意味着C10K问题 ,在Mac OS X上进行异步I / O的最佳方法是什么(假设在Mac和iPhone / iPad上使用)?

On Linux our choice is epoll , on Windows is I/O Completion Ports . 在Linux上,我们的选择是epoll ,在Windows上是I / O完成端口

Top priority is performance and scalability (thousands of connections). 首要任务是性能和可扩展性(数千个连接)。

UPDATE UPDATE

OK. 好。 As Darwin is BSD-like system, my common idea is to use kqueue . 由于达尔文是类似BSD的系统,我的共同想法是使用kqueue Is this a right direction? 这是正确的方向吗? It would be nice to hear from someone experienced in this area. 听听这个领域的经验丰富的人会很高兴。

Thanks 谢谢

Boost.Asio is an excellent cross platform, high performance, C++ networking library. Boost.Asio是一个出色的跨平台,高性能的C ++网络库。 On Mac OS X it uses kqueue for the reactor event loop, other platforms use epoll, I/O completion ports, poll, or select. 在Mac OS X上,它使用kqueue作为reactor事件循环,其他平台使用epoll,I / O完成端口,轮询或选择。 It can scale to thousands of connections without issues. 它可以扩展到数千个连接而不会出现问题。 As the name implies, it promotes asynchronous programming by using the proactor design pattern for concurrency without the use of threads. 顾名思义,它通过使用proactor设计模式进行并发而不使用线程来促进异步编程。

If you use libev, you can switch between a variety of compatible asynchronous IO backends (epoll, kqueue, select, etc...) without worrying about implementation details. 如果使用libev,则可以在各种兼容的异步IO后端(epoll,kqueue,select等等)之间切换,而无需担心实现细节。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM