 with Kumar Rudrappa Wadharikar working as an assistant professor in computer science and engineering department at Valchin Institute of Technology, Solapur. Today we are going to discuss about the gate block scenarios of four and five in Unix operating system. As we have already seen the scenarios of first, second and third in our previous videos. So, now today we start for the four and five. Now, in the learning objectives, outcomes at the end of this lecture or fashion, the students will understand the concepts of gate block scenario four and five and its gate block algorithm also. So, now today here I will give you the just simple review actually what this gate block scenarios are. The algorithm for reading and writing this block 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 blocks. Now, scenario four and five, now here the four scenarios block could not be found on the hash cube and the free list of buffer is empty. And fifth scenario is block was found on the hash cube, but its buffer is currently busy. Now, we have already explained this diagram in our previous videos. Here we will have the hash cube headers, in the hash cube headers we will have the total four blocks block number 0, 1, 2 and 3. Now on the right hand side we will have the buffers, in this buffers we will have the data blocks like 28, 4, 64, 17, 5, 97, 98, 50, 10, 3, 35 and 99. So, now this is nothing but the buffers on the hash cube. Here to implement this particular hash cube we are going to use the hash function that is nothing but the block number mod n, n is nothing but the size of our hash cube headers. Now, let us look at the scenario four, block could not be found on the hash cube and the free list of buffer is empty, means when a particular buffer, a particular process is searching for any block that block is not found on the hash cube. Then the expected thing is what we need to allocate the buffer from the free list, but in this scenario four that particular block is not available on the hash cube and to perform or to continue its task we need to allocate that buffer from the free list, but that free list is again empty. If you look into the free list header at the bottom of this hash cube, here in this diagram, in these links we do not have any free buffer. So, now here in this scenario we are searching for the block 18. Now, if you look into the block 18, like to search for the particular that block 18, we need to execute that hashing function again means what, 18 mod 4 will get the 2 as a reminder means we are going to search that 18 into the block number 2, but now in the block number 2 we will have the 98, 50, 10, but we do not have the 18. So, now here is expected is we need to allocate the buffer from the empty list, free list, but here we do not have any free list, now this is the scenario four. Now here, here what we need to do, here now process A and process B, searching for the block B on the hash cube, but it is not available on the hash cube and free buffer is not available on the free list. Now, in the situation both the process are enters into the slip state, now if you look into this diagram here that is nothing but the race for the free buffer. Here process A cannot find the block B on the hash cube, no buffers on the free list then it will goes into the slip state. Now, when process 1 is in the slip state, now process B is entering into the searching for that buffer or block, now here cannot find the block B on the hash cube, no buffers on the free list then again that process B again enters into the slip state means here both the process A and B are enters into the slipping state. Now somebody free a buffer, it means now here some other process releases the buffers then here we need to allocate that buffer to the this slipping process. Now here we need to wake up the buffer, now here take a buffer from the free list and assign to the block B means here when the buffer is released that buffer is attached to the free list header and then now will assign that buffer to the block B and then after assigning that block B process A or B will request for the block B. So now in this way in scenario 4 the process enters into the slipping states, now scenario 5 this is the last scenario of this get block algorithms, now here block was found on the hash cube but its buffer is currently busy means what now here we are currently searching for some block on the hash cube that block is present but that block is already assigned to some process means some process is performing some operations with the help of that block. So now we will make mark that block as busy if we look into the diagram here searching for the block 99 and that block is busy, now this is the scenario now here what we will do again the same thing here we need to do we need to perform like some process is searching for the 99 we need to execute that block using the hash hashing function means 99 mod 4 will get the 3 as a reminder, now here we will search for that block into that particular block numbers, now here we will get the 3 35 and then next one is 99, here we got the block 99 but that block is already marked as busy and we knew that already that busy means what busy means that particular block is currently available on the hash cube but that is that has been already assigned by some other process, now here we need to again wait, here we will see actually what will happen the kernel guarantees that all process waiting for the buffers will wake up because it allocates buffer during the execution of the system calls and free them before the returning, now here this diagram will represent the race for blocked buffer, now here process A, process B and process C will have the 3 process, now here process A allocate the block to the block buffer to block B and then we will lock that buffer and now here process way will initiate some IO operations, now here slip until IO operation done means what here that process A has been already blocked or locked that particular block B and here it is waiting for the IO operations, now till it will get the IO operations, sorry IO it will goes into the slip, now at that time here process B will come into the picture and it is searching for or finding for the block B on the hash cube but that buffer is locked then again process B is going into the slip state, now again now C came into the picture, now slip waiting for any free buffers that is nothing but the scenario 4 actually and now in this timeline what happen when process A will done with the IO operation then it will wake up, it will perform its operations and it will release the buffer, so now here we are release buffer release is nothing but the function it will release the buffer and it will wake up the others means process A after completion of its task it will wake up the process B and C, now here process C get the buffer previously assign to the block B and reassign buffer to block B, then in process B buffer does not contain block B then start searching again, now this one is nothing but the scenario 5, now here we will see the algorithm how scenario 4 and 5 will work, now here we will have the while buffer not found if block is in the hash cube then what we will do if buffer is busy then go to the slip event buffer from the, sorry buffer become the free till it is get the slip then it will continue, else if buffer are no, sorry if there are no buffers on the free release then again it will goes into the slip that is nothing but the scenario 4 and then it will continue means in both the scenario 4 and 5 the process will goes into the slip state, now think and write the answer for this just give the name to this condition particularly what if buffer is busy and many process requesting for the same buffer, now the situation now what we can say what we can call to this situation now here is the answer we can call it is a race condition means multiple processes trying to access that particular buffer, then all these buffers are goes into the race condition therefore they are racing for the particular buffer means all process must go into the waiting state, references design of any softening system by Morris J batch. Thank you, thank you very much.