Boost logo

Boost Users :

From: Niall Douglas (s_sourceforge_at_[hidden])
Date: 2020-09-01 17:37:58


On 01/09/2020 15:30, Klebsch, Mario via Boost-users wrote:

> Niall Douglas Wrote:
>> Unless you were using a custom io_uring based i/o service, all your asynchronous file i/o on Linux was actually synchronous all along.
>
> It doesn't really matter, whether the IO really is performed asynchronously. The asio API is asynchronously in the sense, that the completion handler is not called from within the async_*() call but later from within the main loop and the main loop does not block, while waiting for the IO operation to complete.
>
> It just happens to be the same Linux API, that is used for async socket IO and for async file io, since on linux systems, sockets are files.

No, on Linux you cannot use epoll() with file descriptors which refer to
seekable devices. You get an error. As the ASIO i/o service on Linux
uses epoll(), one quite literally cannot multiplex i/o on files on Linux
with ASIO without a custom i/o service implementation.

If file i/o appears to work on ASIO on Linux, then ASIO is never handing
those file descriptors to epoll() at all, and is always blocking on
reads and writes. In this situation, it would be more efficient to call
the preadv() and pwritev() syscalls directly.

Niall


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net