0% found this document useful (0 votes)
420 views12 pages

Unit III: Buffer Cache

The document discusses the buffer cache and scenarios for retrieving a buffer from the cache. It describes 5 scenarios that can occur when the kernel uses the getblk algorithm to allocate a buffer for a disk block: 1) the block is found on the hash queue and the buffer is free, 2) the block is not found so a buffer is allocated from the free list, 3) no block is found and the free list buffer is marked as delayed write so it is written and another buffer is allocated, 4) the block and free buffers are not found, or 5) the block is found but the buffer is busy.

Uploaded by

Amol Phatak
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
420 views12 pages

Unit III: Buffer Cache

The document discusses the buffer cache and scenarios for retrieving a buffer from the cache. It describes 5 scenarios that can occur when the kernel uses the getblk algorithm to allocate a buffer for a disk block: 1) the block is found on the hash queue and the buffer is free, 2) the block is not found so a buffer is allocated from the free list, 3) no block is found and the free list buffer is marked as delayed write so it is written and another buffer is allocated, 4) the block and free buffers are not found, or 5) the block is found but the buffer is busy.

Uploaded by

Amol Phatak
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd

Unit III : Buffer Cache

 Buffer Headers
 Structure of a Buffer Pool
 Scenarios for retrieval of a buffer
 Reading and Writing disk blocks
 Advantages and Disadvantages of Cache
Scenarios for Retrieval of a buffer:
The getblk algorithm is used to allocate a buffer for a disk block
There are five scenarios the kernel may follow in getblk to allocate a buffer for
a disk block.
1. The kernel finds the block on its hash queue, and its buffer is free.
2. The kernel can not find the block on the hash queue, so it allocates a buffer
from the free list
3. The kernel can not find the block on hash queue and in attempting to
allocate a buffer from the free list, finds a buffer on the free list that has
been marked “delayed write”. The kernel must write the “delayed write”
buffer to disk and allocate another buffer.
4. The kernel can not find the block on the hash queue ,and the free list of
buffers is empty.
5. The kernel finds the block on the hash queue, but its buffer is currently
busy
Scenarios 1:
1. The kernel finds the block on its hash queue, and its buffer is free.
Scenarios 1:
1. The kernel finds the block on its hash queue, and its buffer is free.
Scenarios 2:
The kernel can not find the block on the hash queue, so it allocates a buffer
from the free list
Scenarios 2:
The kernel can not find the block on the hash queue, so it allocates a buffer
from the free list
Scenarios 3:
The kernel can not find the block on hash queue and in attempting to allocate a buffer
from the free list, finds a buffer on the free list that has been marked “delayed write”.
The kernel must write the “delayed write” buffer to disk and allocate another buffer.
Scenarios 3:
The kernel can not find the block on hash queue and in attempting to allocate a buffer
from the free list, finds a buffer on the free list that has been marked “delayed write”.
The kernel must write the “delayed write” buffer to disk and allocate another buffer.
Scenarios 4:
The kernel can not find the block on the hash queue ,and the free list of
buffers is empty.
Scenarios 5:
The kernel finds the block on the hash queue, but its buffer is currently busy
getblk algorithm:
getblk algorithm:

You might also like