title: Difference between POSIX AIO and libaio on Linux?
body: <p>What I <em>seem</em> to understand:</p>
  
  <p><code>POSIX AIO</code> APIs are prototyped in <code>&lt;aio.h&gt;</code> and you link your program with librt(-lrt), while the <code>libaio</code> APIs in <code>&lt;libaio.h&gt;</code> and your program is linked with libaio (-laio).</p>
  
  <p>What I can't figure out:</p>
  
  <p>1.Does the kernel handle the either of these methods differently?</p>
  
  <p>2.Is the <code>O_DIRECT</code> flag mandatory for using either of them?</p>
  
  <p>As mentioned in <a href="https://stackoverflow.com/questions/6918530/linux-kernel-aio-functionality">this post</a>, libaio works fine without <code>O_DIRECT</code> when using <code>libaio</code>.Okay,understood but:</p>
  
  <p>According to R.Love's <em>Linux System Programming</em> book, Linux supports <em>aio</em> (which I assume is POSIX AIO) on regular files <em>only</em> if opened with <code>O_DIRECT</code>.But a small program that I wrote (using aio.h,linked with -lrt) that calls <code>aio_write</code> on a file opened without the <code>O_DIRECT</code> flag works without issues.</p>