Alex
Alex

Reputation: 13136

Is a difference in the implementation of boost::asio between Unix(AIX, HP-UX) and Linux(RedHat, Ubuntu)?

In Windows the Completion Event Queue is implemented by the operating system, and is associated with an I/O completion port. http://www.boost.org/doc/libs/1_37_0/doc/html/boost_asio/overview/core/async.html

But what of this (select, epoll or kqueue) used for maximum perfomance on Unix and what on Linux, and is there a difference in the implementation of boost::asio between Unix(AIX, HP-UX) and Linux(RedHat, Ubuntu)?

Upvotes: 2

Views: 531

Answers (1)

Sam Miller
Sam Miller

Reputation: 24174

The platform specific implementation notes describes the supported platforms and how the event demultiplexing is implemented. Newer Linux kernels will use epoll(4) while older versions use select(2). AIX and HP-UX both use select(2).

kqueue(2) is used on BSD systems, including Mac OS X and iOS. It is very similar to epoll on Linux.

Generally speaking, epoll will perform better than select. When using select, it performs a linear search over the list of n descriptors, this is O(n). Using epoll has the concept of an epoll_event structure when adding descriptors to the epoll descriptor. This means modifying the list of events to wait for is somewhat expensive, but waiting for these events is very fast at O(1).

Upvotes: 1

Related Questions