The Buffer Cache Used by The File System
The Buffer Cache Used by The File System
As the mounted file systems are used they generate a lot of requests to the block devices to read and write
data blocks. All block data read and write requests are given to the device drivers in the form
of buffer_head data structures via standard kernel routine calls. These give all of the information that
the block device drivers need; the device identifier uniquely identifies the device and the block number
tells the driver which block to read. All block devices are viewed as linear collections of blocks of the same
size. To speed up access to the physical block devices, Linux maintains a cache of block buffers. All of the
block buffers in the system are kept somewhere in this buffer cache, even the new, unused buffers. This
cache is shared between all of the physical block devices; at any one time there are many block buffers in
the cache, belonging to any one of the system's block devices and often in many different different states. If
valid data is available from the buffer cache this saves the system an access to a physical device. Any block
buffer that has been used to read data from a block device or to write data to it goes into the buffer cache.
Over time it may be removed from the cache to make way for a more deserving buffer or it may remain in
the cache as it is frequently accessed.
Clean
Unused, new buffers,
locked
Buffers which are locked, waiting to be written,
dirty
Dirty buffers. These contain new, valid data, and will be written but so far have not been scheduled to
write,
shared
Shared buffers,
unshared
Buffers that were once shared but which are not now
The End.
Abdul Haq
A1922715007 (el)