首页 \ 问答 \ Linux上的POSIX AIO和libaio之间的区别?(Difference between POSIX AIO and libaio on Linux?)

Linux上的POSIX AIO和libaio之间的区别?(Difference between POSIX AIO and libaio on Linux?)

好像明白了

POSIX AIO API在<aio.h>进行了原型设计,并将您的程序与librt(-lrt)链接,而<libaio.h>libaio API与您的程序链接到libaio(-laio)。

我不能弄清楚:

内核处理这些方法之一不同?

2. O_DIRECT标志是否强制使用其中的任何一个?

如在这篇文章中提到的 ,libaio在使用libaio时没有O_DIRECT工作正常.Okay,理解但是:

根据R.Love的Linux系统编程书,Linux 只有在使用O_DIRECT打开时才支持常规文件上的aio (我假设是POSIX AIO)。但是,我写了一个小程序(使用aio.h,与-lrt链接)调用在没有O_DIRECT标志的情况下打开的文件中的aio_write无问题。


What I seem to understand:

POSIX AIO APIs are prototyped in <aio.h> and you link your program with librt(-lrt), while the libaio APIs in <libaio.h> and your program is linked with libaio (-laio).

What I can't figure out:

1.Does the kernel handle the either of these methods differently?

2.Is the O_DIRECT flag mandatory for using either of them?

As mentioned in this post, libaio works fine without O_DIRECT when using libaio.Okay,understood but:

According to R.Love's Linux System Programming book, Linux supports aio (which I assume is POSIX AIO) on regular files only if opened with O_DIRECT.But a small program that I wrote (using aio.h,linked with -lrt) that calls aio_write on a file opened without the O_DIRECT flag works without issues.


原文:https://stackoverflow.com/questions/8768083
更新时间:2023-04-10 14:04

最满意答案

http://jsfiddle.net/它是一个在线编辑器,对于你想要做的听起来很有效。 它配备了一些内置的通用库,只需启动并开始工作就很容易。 当我第一次开始学习javascript时,我发现它非常有帮助。


http://jsfiddle.net/ It's an online editor and works rather well for what it sounds like you're trying to do. It comes with some common libraries built in and it's easy to just start up and begin working. When I first started learning javascript I found it incredibly helpful.

相关问答

更多
  • 我很惊讶这一点起作用:看起来好像有人降级了你的服务器/激活的魔术引号 ,但是: 您正在将未经验证的内容存储在数据库中,然后将其输出到html,甚至不使用类似htmlspecialchars来确保html不会中断; 当您已经将内容输出到浏览器时,您尝试启动会话。 但是你最大的问题是你的脚本非常不安全:你在检查会话时使用的是javascript重定向,例如: if($_SESSION['eid']==null) echo "