POSIX 异步 I/O (AIO) 的状态如何? [英] What is the status of POSIX asynchronous I/O (AIO)?

查看:38
本文介绍了POSIX 异步 I/O (AIO) 的状态如何?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

网络上散布着一些页面,它们以不同的细节描述了 POSIX AIO 设施.它们都不是最近的.目前还不清楚他们在描述什么.例如,官方" (?) 此处提供 Linux 内核异步 I/O 支持的网站 说套接字不起作用,但我的 Ubuntu 8.04.1 工作站上的aio.h"手册页似乎都暗示它适用于任意文件描述符.然后是另一个似乎在图书馆层工作的项目,文档更少.

There are pages scattered around the web that describe POSIX AIO facilities in varying amounts of detail. None of them are terribly recent. It's not clear what, exactly, they're describing. For example, the "official" (?) web site for Linux kernel asynchronous I/O support here says that sockets don't work, but the "aio.h" manual pages on my Ubuntu 8.04.1 workstation all seem to imply that it works for arbitrary file descriptors. Then there's another project that seems to work at the library layer with even less documentation.

我想知道:

  • POSIX AIO 的目的是什么?鉴于我能找到的最明显的实现示例说它不支持套接字,整个事情对我来说似乎很奇怪.是否仅用于异步磁盘 I/O?如果是这样,为什么要使用超通用 API?如果没有,为什么磁盘 I/O 会首先受到攻击?
  • 哪里有我可以查看的完整 POSIX AIO 程序示例?
  • 真的有人真正使用过它吗?
  • 哪些平台支持 POSIX AIO?他们支持哪些部分?有没有人真的支持 似乎承诺的隐含的任何 FD 的任何 I/O"?
  • What is the purpose of POSIX AIO? Given that the most obvious example of an implementation I can find says it doesn't support sockets, the whole thing seems weird to me. Is it just for async disk I/O? If so, why the hyper-general API? If not, why is disk I/O the first thing that got attacked?
  • Where are there example complete POSIX AIO programs that I can look at?
  • Does anyone actually use it, for real?
  • What platforms support POSIX AIO? What parts of it do they support? Does anyone really support the implied "Any I/O to any FD" that <aio.h> seems to promise?

我可以使用的其他多路复用机制非常好,但是四处飘散的随机信息片段让我感到好奇.

The other multiplexing mechanisms available to me are perfectly good, but the random fragments of information floating around out there have made me curious.

推荐答案

网络 I/O 不是 AIO 的优先事项,因为编写 POSIX 网络服务器的每个人都使用基于事件的非阻塞方法.旧式 Java 的数十亿阻塞线程"方法非常糟糕.

Network I/O is not a priority for AIO because everyone writing POSIX network servers uses an event based, non-blocking approach. The old-style Java "billions of blocking threads" approach sucks horribly.

磁盘写 I/O 已经缓冲,磁盘读 I/O 可以使用 posix_fadvise 等函数预取到缓冲区中.这使得直接的、无缓冲的磁盘 I/O 成为 AIO 唯一有用的目的.

Disk write I/O is already buffered and disk read I/O can be prefetched into buffer using functions like posix_fadvise. That leaves direct, unbuffered disk I/O as the only useful purpose for AIO.

直接、无缓冲的 I/O 仅对事务型数据库真正有用,并且那些倾向于编写自己的线程或进程来管理其磁盘 I/O.

Direct, unbuffered I/O is only really useful for transactional databases, and those tend to write their own threads or processes to manage their disk I/O.

因此,最终使 POSIX AIO 处于不服务任何有用目的的位置.不要使用它.

So, at the end that leaves POSIX AIO in the position of not serving any useful purpose. Don't use it.

这篇关于POSIX 异步 I/O (AIO) 的状态如何?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆