Christopher Smith wrote:
>
> Hi there. I still haven't moved to the 2.3.x branch so I can't test
> out the 2.3.x patch yet. :-(
>
> However, I have a question about lio_listio(). I'm still learning the
> aio API's, and I'm wondering about lio_listio() guaruntees of
> atomicity.
>
> I know from reading the POSIX definition of lio_listio() that there is
> no guaruntee about the order that a list of aiocb's will
> complete. What I'm wondering though is if there's any guaruntees about
> concurrency with regards to lio_listio(). For example, is it
> guarunteed that multiple aiocb's will be executing at once?
>
> For example, if I have 3 buffers:
>
> char *buf1 = "one";
> char *buf2 = "two";
> char *buf3 = "three";
>
> Let's say I build a list of aiocb's that indicates that all 3 of these
> buffers should be written to the same file. Is there any guaruntee
> that the file won't look like this:
>
> ontthreewoe
>
> I already know from the spec that this is possible:
> onethreetwo
>
> or:
>
> twoonethree
I don't believe the interweaving of the buffers is possible, since,
presumably the offsets were specified correctly in the aiocb's even
if they all write to the same file. For example, the write of "one"
specifies an offset 0, the write of "two" specifies an offset of 3,
the write of "three" specifes an offset of 6. This would guarantee
only one possibility, "onetwothree". lio_listio() itself does not
impose or relax any condition that the individual aio's do not
possess.
>
> Additionally, I'm curious about the sig argument in lio_listio(). If
> the sig argument is set, and each of the individual aiocb's in the
> listio() list ALSO have their aio_sigevent field set. Do both signals
> get triggered?
Both the individual signals in each aiocb and the final signal for
the completion of the whole list_io get triggered.
>
> P.S.: Any feel as to whether lio_listio() provides significant
> performance advantages over aio_read() & aio_write()?
Since the list_io uses fewer system calls, I'd think that it is
more efficient, but then again it depends on your usage/requirements.
For example, if you are going to use aio to achieve parallelism
in the IO, you may just want to issue a whole bunch of IO's and
wait for it. In this case, it would be more efficient to issue
all the IOs with list_io and specify LIO_WAIT, rather than
do it as individual aio_*() and aio_suspend(), etc.
hope this helps!
ananth.
|