加入收藏 | 设为首页 | 会员中心 | 我要投稿 网站开发网_马鞍山站长网 (https://www.0555zz.com/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长百科 > 正文

Boost application performance using asynchronous I/O-ref

发布时间:2021-01-29 10:10:05 所属栏目:站长百科 来源:网络整理
导读:副标题#e# Linux asynchronous I/O is a relatively recent addition to the Linux kernel. It's a standard feature of the 2.6 kernel,but you can find patches for 2.4. The basic idea behind AIO is to allow a process to initiate a number of I/O

For performance,the completion handler is an ideal spot to continue the I/O by requesting the next asynchronous transfer. In this way,when completion of one transfer has completed,you immediately start the next.

An alternative notification mechanism is the system callback. Instead of raising a signal for notification,this mechanism calls a function in user-space for notification. You initialize the?aiocb?reference into the?sigevent?structure to uniquely identify the particular request being completed; see Listing 6.

...

/ Set up the AIO request /
bzero( (char *)&my_aiocb,sizeof(struct aiocb) );
my_aiocb.aio_fildes = fd;
my_aiocb.aio_buf = malloc(BUF_SIZE+1);
my_aiocb.aio_nbytes = BUF_SIZE;
my_aiocb.aio_offset = next_offset;

(编辑:网站开发网_马鞍山站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!