Re: aio_read2() and aio_write2()

From: Vinícius_dos_Santos_Oliveira <vini.ipsmaker_at_gmail.com>
Date: Sun, 14 Jan 2024 00:35:51 UTC
Em sáb., 13 de jan. de 2024 às 21:23, Alan Somers
<asomers@freebsd.org> escreveu:
> If you shouldn't start a second stream until the first has finished,
> the what is the reason for using AIO?  This doesn't sound like a good
> application for AIO to me.

You use AIO on different files. AIO doesn't block the thread -- on
FreeBSD with AIO daemons -- that initiated the (A)IO operation. The
kernel is in the best position to judge how many threads should be
used for file IO. It's best to leave this role with the kernel instead
of the userspace process.

The process remains unblocked to perform other concurrent tasks (e.g.
socket IO through kqueue).

Furthermore, Boost.Asio won't use AIO *just* for serial IO. Whenever
possible, the application can use the random access interface as well
(one can even mix both approaches for different files).

It works fine on Linux and Windows. I don't see why FreeBSD should be
special here.

-- 
Vinícius dos Santos Oliveira
https://vinipsmaker.github.io/