 working as an assistant professor in computer science and engineering department at Volchian Stop Technology, Sola. Today, we are going to discuss about the buffer pool scenarios. As we have seen in our previous videos, we have already covered what is meant by buffer, what is buffer cache, what is buffer pool and hash cube and we have also covered the gate block scenario one. So, now today we are going to see the gate block scenario second and third in Unix operating system. At the end of this lecture, our session student will understand the concepts of gate block scenarios two and three and the gate block algorithm for the same. Now, now basically I will just give you the review, it means what actually we are going to do or what we are actually going to learn in this session like the algorithms for reading and writing the disk blocks uses the algorithm gate block to allocate the buffer from the pool. There are typically five scenarios the kernel may follow in gate block to allocate a buffer for a disk block. Now, we have already covered the scenario first in our previous video. So, now today we will see the scenario second and third. Now, scenario two the block could not be found on the hash cube. So, a buffer from the free list is allocated and now in the scenario third block could not be found on the hash cube and allocating a buffer from the free list, but that buffer is marked as a delayed write is allocated. The kernel must write the delayed write buffer to the disk and allocate the another buffer means what basically the delayed write is a one more concept in these buffer scenarios. We will see this delayed write in the scenario three when we are going to explain in detail. So, now basically we will see the some examples how actually this scenario second and third is going to be work. We have already seen this diagram in our previous videos. So, now here we will have the hash cube headers, we will have the total four blocks block number 0, 1, 2, 3 and we will have the maximum four blocks. So, that is why our in a hashing function the n number is 4. So, now here we will have the 28, 4, 64 are the buffers in this way we have this diagram. So, now we will see how actually the scenario two is going to be work. Now, scenario two is nothing but the like block could not be found on the hash cube. So, a buffer from the free list is allocated means there is one process that process is going to search for the block 18. So, now while searching that process what actually it will perform that process what we will do that process will send the request to the kernel like requesting for the block 18. So, then kernel what will do it will perform the hash function on the block 18 to get the exact address of that block. So, now here they are going to use the block number mod n that is the hash function. Now, here we are searching for the block 18. So, what we will do 18 mod 4 here what we will get we will get the reminder as a two. So, what we will do we will search for that two search for that block in block number two. So, now when we will look at this block number two will have 98, 50 and 10 in our buffer pool, but we do not have that 18. So, now here means block could not be found on the hash cube means 18 is not found in the hash cube. So, now here we need to allocate that buffer to the free list allocate that buffer from the free list. So, now here in our free list will have the 3, 5, 28, 4, 97, 10 these are the links will have the free list. So, now what we will do as we have explained previous video to achieve or to allocate this free buffer we are going to use the list recently used buffer. Now, here we will identify the list recently used buffer is third. So, now here what we will do in the next slides what we have done we have removed the first block from the free list and assigned it to the 18. So, now we will get the list of buffers like in block number two 98, 50, 10 and 18 in this way we will remove the buffer from the free list and assigned to the 18. So, now that is nothing but our scenario two, but now here one more thing here we need to update the free list again because we had removed the three as we have seen in the previous slide that three buffer will remove from the free list and as make it as a 18 and we will give the link the first buffer in this free list is 5. So, now in this way it will work. Now, we will go for the next slides. Now, here the block could not be found on the hash queue. So, the buffer from the free list is allocated as we have seen in the previous block. Now, process is now looking for the block 18, but that block 18 is not present in the hash queue the kernel allocate the buffer on the free list. Now, remove the third block from the free list and assign to the block 18 all these steps we have already discussed in the previous slides. So, now we will go for the scenario third. Now, block could not be found on the hash queue and when allocating a buffer from the free list a buffer marked delayed write is allocated. Then the kernel must write the delayed write buffer to the disk and allocate the another buffer means what basically here we need to understand the what is the delayed write. The delayed write is the term used to describe the method in the Unix kernel uses to write the disk block back out to the physical media means when any process is requesting for some block and that block is currently not available on the hash queue. Then what we will do we will allocate the buffer from the free list, but now that free list is marked as the delayed write means that particular block has been already updated by some other process and still that block data is not updated back it means or written back on to the disk means that recent data is not maintained on the disk. So, now here we cannot overwrite that buffer because it is a delayed write means here we cannot allocate that buffer to the requested requested by that process. So, now here let us take the example now here block 3 and 5 are the delayed write block on the free list or look into the diagram. Now, what we will do here we will search for the block 18 as previously we have seen that one. Now here searching for the block 18 now delayed write block on the free list. Now in the scenario 2 we have already seen the block 18 is not present on the hash queue then we need to allocate that third buffer to the 18, but now here third is already a delayed write marked as a delayed write and then we need to find out the next buffer. Now next buffer is our fifth but again that fifth is again the delayed write means the data from the third buffer and the fifth buffer needs to be written right back on to the disk. So, now here we need to find out the next free buffer now here we will get the next free buffer as a 4. So, now look into the buffer what we will do we will allocate that buffer and we will make the changes in the free list header like third and fifth are the delayed write. So, need to remove that buffers from the free list because currently we are writing that data back to the disk from the third and fifth. So, now in this way we will update the list now here if you look into the diagram here we will get the 28 is the next free buffer then 97 then 10 and then the next pointer of the 10 is the free list header. So, now in that way we will allocate that 18 block into the block number 2. So, now this is nothing but the delayed write. So, now if we look into the diagram sorry algorithm here we will searching for the buffer till the buffer is not found now while buffer not found the loop is continued if the block not in a hash queue then what we will do it will come into the next if buffer mark for the delayed write that is scenario third then what we will do the asynchronous write buffer to the disk and then continue means we are not going to perform any action on that particular buffer till that buffer is going to be written back on to the disk now that is nothing but the scenario third now on to the scenario 2 means what if the block is not in a hash queue and if it is not marked as a delayed write then what we will do remove that buffer from the old hash queue and put buffer on to the new hash queue and written the buffer that is nothing but our scenario 2. Now think and write what is delayed write pause the video and write your answer here the answer is delayed write is the term used to describe the method the Unix kernel uses to write the disk block back on to the physical media references are we have referred the design of Unix operating system book by the author of Moorish J batch. Thank you.