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

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.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.