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. 文件中data和meta-data的cache属性:
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.h中file 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。