Introduction to direct I/O mechanism in Linux
Introduction to direct I/O mechanism in Linux
Huang xiaochen, software engineer, IBM Huang xiaochen, and IBM System Z automation technical support software engineer.
Introduction:For traditional operating systems, common I/O operations are usually cached by the kernel. Such I/O is called cache I/O. The file access mechanism described in this article is not cached by the operating system kernel, and data is directly stored on disks and applications.ProgramAddress Space for transmission, so the file access mechanism is called direct I/O. Linux provides such a file access mechanism. For applications that store I/O cached in the user's address space, direct I/O is a very efficient method. This article will discuss the design and implementation of direct I/O Technology in Linux based on Kernel 2.6.18.
Release date:December 30, 2010
Level:Elementary
Access:20644 views
Comment: 2 (View | add comments-Log On)
Average score (35 scores)
Score for this article
Motivation for direct I/O
Before introducing direct I/O, this section describes why direct I/O occurs, that is, the shortcomings of traditional I/O operations.
What is cache I/O (buffered I/O)
Cache I/O is also referred to as standard I/O. Most file systems use cache I/O by default. In Linux's cache I/O mechanism, the operating system will cache the I/O data in the file system's page cache, that is, the data is first copied to the buffer zone of the operating system kernel before it is copied to the address space of the application from the buffer zone of the operating system kernel. Cache I/O has the following advantages:
- Cache I/O uses the operating system kernel buffer, which isolates the application space from the actual physical device to a certain extent.
- Cache I/O can reduce the number of disk reads and improve performance.