异步I/O与I/O调度器:提升系统性能的关键
1. 异步I/O
异步I/O的执行需要底层的内核支持。POSIX 1003.1 - 2003定义了aio接口,Linux系统实现了这些接口。aio库提供了一系列函数,用于提交异步I/O操作并在操作完成时接收通知:
#include <aio.h>
/* asynchronous I/O control block */
struct aiocb {
int aio_fildes; /* file descriptor */
int aio_lio_opcode; /* operation to perform */
int aio_reqprio; /* request priority offset */
volatile void *aio_buf; /* pointer to buffer */
size_t aio_nbytes; /* length of operation */
struct sigevent aio_sigevent; /* signal number and value */
/* internal, private members follow... */
};
int aio_read (struct aiocb *aiocbp);
int aio_write (struct aiocb *aiocbp);
int aio_error (c
超级会员免费看
订阅专栏 解锁全文

被折叠的 条评论
为什么被折叠?



