 myself Rohit Kumar Rudrapa Vakhtarikar working as an assistant professor in computer science and engineering department at Valkchan Institute of Technology, Solapur. Today, we are going to discuss on buffer pool, get block scenario 1 in Phoenix operating system. At the end of this session or lecture, students will understand the concepts of get block scenario 1 and get block algorithm. Scenarios for the reply of buffer. As we have seen in our previous video, how we are going to maintain the buffer pool and how we are going to maintain the buffer structure and free buffer also. All these things we have already seen in previous videos. So, now here today we are going to see when any process wants to access some data from the disk block, at that time typically it will search into the buffer pool. So, now while searching what are the different scenarios you need to face that we are going to discuss here. It means that process will send the request to the kernel. Kernel will start for the accessing or retrieving the buffer from the free list or from the hash queue. There will be the different scenarios. See this retrieval of buffer will have the five typical scenarios. So, now we will start the algorithm for reading and writing the disk block. Use the algorithm get block to allocate the buffer from the pool. There are typically five scenarios. The kernel may follow in get block to allocate the buffer for a disk block. Now, first of all we will see the what are the different scenarios. Now the first scenario the block is found on its hash queue and its buffer is free. Basically the buffer have the two types of statuses, two status buffer empty and buffer free. The buffer empty means there is no data block in the buffer. It means that particular data block is not available in the hash queue. The buffer is empty and that buffer empty will allocate to the free list. Now buffer free means what? The data block is present in the buffer, but that buffer is not in use by any process that is generated by the buffer free. In this scenario data block could not be found on the hash queue. So a buffer from the free list is allocated to that process by the kernel. Third scenario data block could not 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 another buffer. Means in this third scenario kernel will allocate the buffer from the free list. Now in this free list that particular buffer is delayed write. Now here what is mean by the delayed write? Delayed write means that particular buffer or data block has been modified by some process and that is still available in the buffer and that is not return back to the disk. That is nothing but the delayed write. If we will allocate that delayed write to the any process at that time that data is overwrite, overwritten. So that is the inconsistency of data. Now fourth scenario block could not be found on the hash queue. The free list of buffer is empty. Last one block was found on the hash queue but its buffer is currently busy. So now these are the five different scenarios. Now the buffer on hash queue already we have explained this diagram in our previous video. It means how we are going to add this data block and that is what is hash queue headers. How we are going to allocate these different data blocks like 28, 4 and 64. I explain in a short here we are going to use the hash function that is block data block mod n. Now that data block is nothing but the any one from this diagram like take it as a 8, 17, 98, 55 for anything as a data block and mod n is nothing but the size of our hash queue. Means if we will have the total size of header is 4. Now I want to access the data block 3 or I want to add the data block 3 into the hash queue. Now what we will do? We will use that function how 3 mod 4 the reminder will get the 3. So now we will attach that data block 3 in the block number third. We have seen let us look at the fourth queue in that way we have allocated or assigned all the data blocks to the block number 0, 1, 2, 3, 4. Now we will see the next things. Now this is the diagram in this diagram we will have the same thing as we have seen in the previous slide that is the diagram here what we have done we have added one free list header node in the hash queue headers. The main aim of this free list header is it will create the link of free list free buffers in our system. Now here we will take and as we have already explained in our previous slides each data block or node in this hash queue will have the two pointers forward pointer and backward pointer. So now with the help of this all these free list headers are going to be maintained. Let us look at the headers. Now here the free list header will start to point into the third it means the third buffer is free then its next pointer is pointing to the five the five is free then fourth one is also free then that fourth is next link is 28 is free after that 28 it is pointing to the 97 that is 97 is again free and then 97 is pointing to the 10 means 10 is also free and now lastly 10th next pointer forward pointer is pointing to the free list header it means in these links will have all these free list. Now here now we are searching for the block 4. Now it means one process is instruct to the kernel or request to the kernel to the access for the data block 4. So kernel what we will do? Kernel will directly going to search in the disk block it will firstly search on to the hash queue. Now here it will find out here it will got the fourth. So now here we need to remove that fourth block from the free list and assign it to the particular process. Now we will see how we are going to manage this into the next diagram. Here the removing the block 4 from the free list means once this block 4 is assigned to any process at that time we need to remove it from our free list buffer. Now here what we will do? Here we will start from the again from the free list header. Free list header as we have seen the third is pointing to the fifth buffer data block sorry and then 5 data block next pointer is pointing to the 28. But if you look at the previous diagram that 5 is pointing to the data block 4. So now here we have removed that 4 and fifth forward pointer is pointing to the 28. And then 28's forward pointer is pointing to the 97. Means if you look at the previous here fourth block sorry fifth blocks forward pointer is pointing to the fourth and fourth forward pointer is pointing to the 28. So here we have removed that two pointers forward and backward pointers of the fourth data block and assigned it to the 28. Let's see here 5th forward pointer is pointing to the 28 and 28's forward pointer is pointing to the 97 and 97's forward pointer is pointing to the 10 and 10 is pointing to the free list. So now in that way when process asking for the data block 4 or any data block in this way we will remove the block from the free list and assign that list to the assign that things to the process. Now here we will see the scenario of the algorithm scenario for the first that is the algorithm. Now here what we will have here we have the get block algorithm. So now here what we are going to find out is nothing but the buffer. So while we need to start from like while buffer not found means we need to continue that iterate that buffer till we found the buffer. Now if block in a hash queue if that particular block is in the hash queue then we will enter into the loop and if that buffer is not busy then what we will do we will make that buffer busy as per the scenario 1 and next is we remove that buffer from the list and we will return that buffer. So in this way this scenario 1 algorithm will work. Now think and write define the statement block is found on the hash queue and its buffer is busy think on think and write. The answer is when process 2 searching for the particular block and if it is present on the hash queue but it is currently held by the some other process. Now in the situation process 2 is writing the process 2 is in the waiting state. So now in this way all these things will work reference or design of unique operating system by the j batch.