Why does boost ASIO need to be implemented with Proactor mode?

Source: Internet
Author: User

most of the reactor patterns used in high-performance network libraries under Linux are implemented, and the Boost ASIO uses Epoll and select to simulate Proactor mode under Linux, which affects its efficiency and complexity .
look at the performance of Aboutspeaker's own Linux Reactor network library and ASIO, which is about 1/5 higher than ASIO performance (throughput). Since the network library under Linux has a high reactor performance, why boost ASIO Do you want to use the simulated Proactor mode for Linux?
or why is ASIO not in win and Linux in reactor mode? Is this a better choice for performance? And more adaptable to the market? server-side after all, a lot of Linux.

it is difficult to achieve efficient and scalable Reactor under Windows. First, the Win32 API waitformultipleobjects can only wait for 64 handle (maximum_wait_objects) at the same time, and then the Select () of WinSock is buggy, especially in the error handling party. There are many wonderful behaviors on the surface (see comments on this in the various cross-platform network library code); Finally, the new Wsapoll () function in Windows Vista is not compatible with POSIX poll ().

Windows has its own set of highly efficient asynchronous IO models (almost equivalent to proactor), while supporting file IO and network IO, but Linux has only efficient network sync IO (IO multiplexing such as epoll are synchronous reactor, And does not support disk files), the efficient IO programming model is fundamentally incompatible (Windows can send network events to the event queue of the GUI thread, somewhat similar to Reactor, but it seems that a process can have only one GUI thread, so its scalability is limited on multicore systems).

therefore, to be efficient and cross-platform, ASIO can only use the Proactor model. Inevitably, it loses a bit of efficiency on Linux.

Why does boost ASIO need to be implemented with Proactor mode?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.