I am testing kernel asynchronous io functions (not posix aio) and am trying to figure out how it works. The code below is a complete program where I simply write an array re
First of all, good job using libaio
instead of POSIX aio
.
Are there any restrictions on the usage of O_DIRECT ?
I'm not 100% sure this is the real problem, but O_DIRECT
has some requirements (quoting mostly from TLPI):
posix_memalign
)At a glance, I can see you are not taking aby precautions to align memory in allocate_2D_matrix
.
If I do not open the file using O_DIRECT, things work fine, but it beats the purpose of having async writes.
This happens not to be the case. Asynchronous I/O works well without O_DIRECT
(for instance think of the number of system calls slashed).