2 Mar 2017

Unix 3.2 Buffer Header


BUFFER HEADER 




Buffer Header

When the system initializes the kernel allocates the space for the buffer cache. The buffer cache contains two regions/arts. One for the data/files that will be read from the disk, second the buffer header.


The data in the buffer cache corresponds to the logical blocks of the disk block of file system. The buffer cache is “in memory” representation of the disk blocks. This mapping is temporary as the kernel may wish to load some other files’ data into the cache at some later stage.

There will never be a case when the buffer has two entries for the same file on disk as this could lead to inconsistencies. There is only and only one copy of a file in the buffer.
The buffer header contains the metadata information like device number and the block number range for which this buffer holds the data. It stores the logical device number and not the physical device number. The buffer header also contains pointer to a data array for the buffer (i.e. pointer to the data region) .

The buffer header also contains the status of the buffer. The status of the buffer could be :

  • The buffer is currently locked or unlocked
  • The buffer contains valid data
  • The kernel must write the buffer contents to disk before reassigning the buffer(write delay)
  • The kernel is currently reading or writing the contents of the buffer to disk,
  • A process is currently waiting for the buffer to become free.


Friends, if you find this post useful please comment below. If you want quick notes for any topic please mail us at hardikpanchal551@gmail.com, we will try to provide notes if possible. Thanks for reading.

No comments:

Post a Comment