Buffer Cache in UNIX Operating System

Buffer Cache:

I/O operations with a disk are handled through the buffer cache. The data transfer between the buffer cache and the user process space in the main memory in the main memory. To manage the buffer cache, 3 lists should be maintained.

1. Free List: The kernel maintains a free list of buffers that preserves the LRU order. The free list is a doubly-linked circular list of buffers with a dummy buffer header that marks its beginning and end. The kernel takes a buffer from the head of the free list when it wants any free buffer.

2. Device List: It is the list of all buffers currently associated with each disk.

3. Driver I/O queues: List of buffers that are waiting for I/O on a particular device.