Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 13 Jan 2024 21:35:51 -0300
From:      =?UTF-8?Q?Vin=C3=ADcius_dos_Santos_Oliveira?= <vini.ipsmaker@gmail.com>
To:        Alan Somers <asomers@freebsd.org>
Cc:        freebsd-threads@freebsd.org, Konstantin Belousov <kib@freebsd.org>
Subject:   Re: aio_read2() and aio_write2()
Message-ID:  <CAK9Rve%2BkMyCNCcrX1WDAyB8ggD94mbZa8irEZ31G7R8n%2B52JMw@mail.gmail.com>
In-Reply-To: <CAOtMX2ijQ=KsccMyqH-yAn6SJPR7MD_yy6CF0R2vNrQ-fhUq2Q@mail.gmail.com>
References:  <CAOtMX2haq%2BErvqD2PDYKUGRgdCrk2SDjtoPL-W5jR8q8_4denA@mail.gmail.com> <CAK9RveJLK9uU0twM%2BKznUNnUnsqzwoqidPN8dzNptMQ50Z7r1Q@mail.gmail.com> <CAOtMX2ijQ=KsccMyqH-yAn6SJPR7MD_yy6CF0R2vNrQ-fhUq2Q@mail.gmail.com>

index | next in thread | previous in thread | raw e-mail

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/


help

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAK9Rve%2BkMyCNCcrX1WDAyB8ggD94mbZa8irEZ31G7R8n%2B52JMw>