I / O buffer cache for a disk file in the Linux kernel

I have a question about the kernel I / O cache for a disk file. As I know, when write () or read () is called, there is a buffer cache in kernel space for disk I / O. My question is, does this I / O buffering apply only to the disk file or does it also apply to the terminal, FIFO, pipe and sockets?

thanks

+4
source share
1 answer

It is called the "page cache." It consists of pages supported by files and "anonymous pages" supported by swap. All of this is part of the Linux virtual memory subsystem (VM).

It is not used for TTY, FIFO, pipes or sockets. Each of them provides its own buffering by nature; for example, the data you write in the pipe must be somewhere else before it is read again. But this buffering has nothing to do with the VM subsystem.

[update]

Note that this buffering is completely independent of the user space buffering provided by (for example) fwrite() . (I see that you asked a similar question before, and it is unclear whether you understand this difference.)

+6
source

All Articles