 Hello everyone, I, Mrs. Komal Rahul-Pardesi working as an assistant professor in Department of Computer Science and Engineering of Valchin Institute of Technology, Swelapur going to deliver a lecture on accessing and releasing an I-Node using algorithm I get and I put respectively. The learning outcome of this session are at the end of this session student will be able to describe how kernel allocates in core copy of an I-Node, calculate byte offset for given I-Node number, describe how kernel releases in core copy of an I-Node. Let us see in core I-Node recall that I-Node is nothing but index node as we already know that in Unix operating system everything is created as a file. So each file has its unique I-Node, I-Node has two types, disk I-Node and in core I-Node. Disk I-Node is present on disk while in core I-Node is present in memory. Whenever kernel wish to access the copy of an I-Node it has to copy the content of the disk I-Node into the in core I-Node. So disk I-Node is nothing but the disk copy while in core I-Node is nothing but the memory copy. As we already know the in core copy may differ from the disk copy. The contents of I-Node get changed whenever there is change in file content or ownership or permissions etc. So it is necessary to write the content of this in core I-Node back into the disk I-Node to maintain the consistency of the data present in disk I-Node. Now kernel identify the particular I-Node by their file system number and I-Node number. So the algorithm I get is used to access an in core I-Node. Let us see what is an I-Gate algorithm. I-Gate algorithm is used to access an in core copy of an I-Node. It is used to allocate the in core copy of an I-Node. The input given to the I-Gate algorithm is file system I-Node number. Whenever that I-Node number is given to the algorithm it has to check whether that I-Node is present in cache. If it is present in the cache then check that whether that I-Node is locked means whether it is used by some other process. If it is used by some other process then the process which wish to access that I-Node must slip for the event that I-Node should become unlocked and it will enter back into the while loop. But suppose I-Node is present in the cache. I-Node is not present in the cache then it has to remove the new I-Node from the free list, it has to reset the I-Node number and file system number, it has to remove that I-Node from the old hash queue and place it on the new hash queue, read the I-Node from the disk using algorithm buffer it and initialize the I-Node reference count equal to 1 and return that I-Node with reference count 1 to the process. Now suppose that I-Node is present in cache and it is not locked then kernel has to check whether it is present in free list. If it is not present in free list also then kernel has to return an error because in this case kernel don't know when that I-Node will become free. But suppose I-Node is present in cache it is not locked and it is present on free list means that I-Node is free. So remove that I-Node from the free list, increment the I-Node reference count, return that I-Node to the process and stop. Suppose while searching that I-Node kernel find free list as empty. So in this case also kernel can return an error because there are no I-Nodes present on free list. So kernel has to wait till other process releases that I-Node. So to summarize the I-Get algorithm is used towards the beginning of the system call whenever a process first access a file and this algorithm returns an I-Node locked I-Node to the process with reference count equal to 1. Now just pause a video and think if process finds locked I-Node in cache then process enters in sleep state and it has to start the loop again from the beginning after waking up. Why this is so means why process has to go to the sleep state if that I-Node is locked by some other process. Pause a video and write down your answer yes let us see now as we already studied this algorithm in I-Get algorithm the input is I-Node number check whether it is present in the cache if it is present then check whether it is locked or not. If it is locked then process has to sleep process has to sleep because that I-Node already exist in memory. So there is no need to take new I-Node from free list. So unlock that I-Node is placed on the free list of I-Node whenever process is going to unlock the I-Node automatically that I-Node is going to be placed on the free list. So to search that I-Node again process has to start from the beginning of the loop. Process enters into the sleep state by setting a flag in in core copy of an I-Node. So whenever some other process freeze that I-Node the all the processes which are waiting for that I-Node wake up and whenever a particular process get access to that I-Node for which they are requesting that again that I-Node gets locked. So as that I-Node is already present in cache no need to take the I-Node from the free list and process has to sleep for the event that I-Node should become free by some other process and that's why process enters back into the loop. Now once that I using I get algorithm the process gets the in core I-Node. Now once it gets the in core I-Node it is the task of kernel to get the content of the disk I-Node into the in core I-Node. For that purpose kernel has to take the logical disk block number. The logical disk block number can be found by using the formula block number equal to I-Node number minus 1 divided by number of I-Node per block plus start block of I-Node list. Here this operation slash gives the integer part of the quotient. Now let us consider start disk block number is 2. Consider we require start disk block number and consider the number of I-Nodes is equal to 8. So to find out the block number for I-Node number 9 using the formula we can get the block number for I-Node number 9 is equal to 3. Now as per the given condition if we see this diagram the block starts at block number 2 each has capacity of 8. So 1 to 8 are present in block number 2 9 to 16 are in block number 3 and 17 to 24 are in block number 4 and so on. So if we can see here the I-Node number 9 is present in block number 3. If we search for I-Node number 18 then we will find it in block number 4 using the formula again ok. Once we get the block number now it block number of the disk I-Node now it is the task to read the content of this disk I-Node into the in core copy of an I-Node. So to read that content we require a byte offset. The byte offset is calculated using I-Node number minus 1 modulo number of I-Nodes per block into size of disk I-Node. Here the modulo operation gives us remainder. Now consider the size of disk I-Node equal to 64 bytes number of I-Nodes per disk block is equal to 8 as given find the byte offset for the I-Node number 8. So byte offset 8 minus 1 7 modulo 8 will give us remainder 7 into 64 is equal to 448. So for I-Node number 8 we will get the byte offset 448 from where the kernel will read the content of the disk block into an I-Node. So this is what about the I-Gate algorithm. Now let us see how kernel releases an I-Node using the I-put algorithm. I-put algorithm is used to release in core I-Node. So input to this algorithm is in core I-Node. Lock that I-Node if it is not already locked. Decrement the I-Node reference count. If reference count is equal to equal to 0 then check whether the I-Node link count is 0. If yes then free that disk block using algorithm free. Set file type to 0 free I-Node using algorithm I-free. But if link count is not equal to 0 then check whether the file access permissions has been checked whether the I-Node contents are changed or whether file contents are changed. If yes then update the copy of the disk I-Node by copying the content of in core I-Node into the disk I-Node. Then put that I-Node on the free list. So by putting the I-Node on the free list and releasing that I-Node we can that kernel can stop and in this way that algorithm I-put releases the I-Node. This is what about I-Gate and I-put algorithm which is used to access the in core I-Node and release an in core I-Node respectively. So this is the references thank you.