码迷,mamicode.com
首页 > 其他好文 > 详细

Direct I/O,Synchronous I/O的概念

时间:2018-04-10 13:37:16      阅读:156      评论:0      收藏:0      [点我收藏+]

标签:tab   cells   require   caching   open   ret   cin   nbsp   tor   

Direct I/O概念:

Direct I/O is a way to avoid entire caching layer in the kernel and send the I/O directly to the disk.

想要使用direct io的模式,可以这样做:

Opens files with O_DIRECT flag.


Synchronous I/O概念:

Synchronous I/O is any I/O (system I/O with or without O_DIRECT, or stream I/O) performed to a file descriptor that was opened using the O_SYNC or O_DSYNC flags.


几个Flag的区别:

O_DIRECT  I/O operations performed against files opened with O_DIRECT bypass the kernel‘s page cache, writing directly to the storage.
O_SYNC File data and all file metadata are written synchronously to disk.
O_DSYNC     Only file data and metadata needed to access the file data are written synchronously to disk. Metadata that is not required for retrieving the data of the file may not be written immediately.


参考资料

===============

What is direct I/O anyway?

http://www.alexonlinux.com/what-is-direct-io-anyway 

Ensuring data reaches disk

https://lwn.net/Articles/457667/

Direct I/O,Synchronous I/O的概念

标签:tab   cells   require   caching   open   ret   cin   nbsp   tor   

原文地址:https://www.cnblogs.com/awpatp/p/8777796.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!