[深入理解文件系统之一] IO系统调用


1. IO system call


six basic operation:


open

create

close

write

read

lseek


ioctl

unlink



更高级的IO system call:


pread

pwrite


readv

writev


preadv (calls combine the effects of lseek() and read() (or write()) into a single system call.)

pwritev


aio_read

aio_write

lio_listio



unlink

flush

dup2


2.  文件中datameta-datacache属性:


O_SYNC: write operation returns only when both data and meta data stored on physical disk


O_DSYNC: write operation   returns only when data  stored on physical disk


O_RSYNC: read operation returns before time-stamp updated


O_DIRECT: return only when data submitted to disk driver's IO queue (?)



3. memory mapped files

根本功能是:把一个文件映射到当前进程的用户空间


4. stdio file operation

重点是理解下面的数据结构,他说unistd.h file IO stdlib.hfile io的接口:

struct _IO_FILE {

char *_IO_read_ptr;

/*

Current read pointer */

char *_IO_read_end;

/*

End of get area. */

char *_IO_read_base;

/*

Start of putback and get area. */

char *_IO_write_base;

/*

Start of put area. */

char *_IO_write_ptr;

/*

Current put pointer. */

char *_IO_write_end;

/*

End of put area. */

char *_IO_buf_base;

/*

Start of reserve area. */

char *_IO_buf_end;

/*

End of reserve area. */

int

int

_blksize;

_fileno;


};


typedef struct _IO_FILE FILE;


学习并了解到的新的函数:

setbuf();

setvbuf()

setbuffer();

setvbuf()


文中还提供了经典的例子,来对比和分析NON buffer/Line buffer/File buffer对性能的不同影响。 还有一个重要的思想就是:如果对性能要求很高,需要尽可能地bypass std io library


















本文转自存储之厨51CTO博客,原文链接:http://blog.51cto.com/xiamachao/1891178 ,如需转载请自行联系原作者



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值