0

I have to write a lot of data to a pipe. Can I use the Linux calls io_submit/io_getevents for writing to Named Pipes or it is defined only for regular files. I tried finding any document which explains the AIO over pipes but couldn't. Can someone help here.

Majorly I am concerned about the aio_offset field in struct iocb. What if a data packet with offset 8096 is scheduled for read/write before a data packet of offset as 4096.

1 Answer 1

1

Linux AIO is not just limited to regular files - it can be used on block device special files. I expect AIO writes cannot be used on pipes though, due to pipes not being capable of seeking.

IOCB_CMD_PWRITE

pwrite() writes up to count bytes from the buffer starting at buf to the file descriptor fd at offset offset. The file offset is not changed.

The file referenced by fd must be capable of seeking.

The point of AIO, is to be able to queue multiple direct IO writes (or reads) to a block device without having to use threads.

To improve the performance of bulk transfers over a pipe, I would suggest increasing the pipe buffer size from 4kB, to not more than 64kB... except that 64kB is already the default on modern Linux.

1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .