 Hello everyone, today we are going to discuss on the topic Disc Scheduling in Operating System Part 4. Let us see the learning outcome of this topic. At the end of this session, students will be able to understand scheduling disk requests using look and see look algorithm in the disk scheduling. First of all, we see look algorithm. Look algorithm is like a scan algorithm to some extent except the difference that in this scheduling algorithm, the arm of the disk stops moving inwards or outwards when no more requests in that direction exist. Okay? Arm of the disk is there and this algorithm tries to overcome the overhead of scan algorithm which forces disk arm to move in one direction till the end regardless of knowing if any request exists in the direction or not. Here head starts from the first request at one end of the disk and moves towards the last request at the other end servicing all the requests in between. What is the advantage of this look algorithm is? It gives slightly better seek time than any other algorithm. And what is the disadvantage? It causes long waiting time for the cylinders just visited by the head. Let us see the algorithmic steps for look algorithm. First step, let request array represents an array storing indexes of tracks that have been requested in ascending order of their time of arrival and head is the position of the disk head. Actually head is given as the position of the disk head in the algorithm or in the example also. Second step, the initial direction in which head is moving is given and it services in the same direction. Third step, the head services all the requests one by one in the direction head is moving. Fourth step is, the head continues to move in the same direction until all the requests in this direction are not finished. Fifth step is, while moving in this direction calculate the absolute distance of the track from the head. Sixth step is, increment the total seek count with this distance. Seventh, currently serviced track position now becomes the new head position. Eighth, go to step five means we have to repeat the step five until we reach at last request in this direction. Nine, if we reach when no request are needed to be serviced in this direction, reverse direction and go to step three until all tracks in the request array have not been serviced. Now let us see all these steps with the help of example. Example is, this contains 200 tracks that is 0-199. Request queue contains track number 82, 170, 43, 140, 24, 16, 190 respectively. Current position of the redrat head is given and which is at 50 position. Now we have to calculate total number of tracks movement by redrat head using Luke algorithm. Now what they said? If suppose redrat head takes one nanosecond to move from one track to another, then what is the total time taken that we have to calculate? And here we assume the direction is going towards larger value means what? The current position of the head is given 50. Then the direction is we are moving towards larger value that is above 50. So here current position of the head is 50. From 50 we are moving towards larger value. The larger value of 50 is 82. Next we are moving larger value 140 which is then 82. Then we are moving larger value after 140 is 170. Then we are moving larger value from 170 to 190. Then after 190 it will not request any in between and it will go directly to the lower value of the 50. That is a 43. Then lower value of the 43 that is a 24. Lower value of the 24 that is a 16. Now here the movement stops. Now here we calculate redrat head taken one nanosecond to move from one track to another. What is the total time is 314 nanosecond. How it is? So from 190 minus 50 plus 199 minus 16 is equal to 314. After this algorithm see the question. Question is in the dash algorithm the disc arm goes as far as the final request in each direction. Then reverses direction immediately without going to the end of the disc. Now we have seen. Give the answer. Answer is A. Look algorithm is there which disc arm goes as far as the final request in each direction and then reverses direction immediately without going to the end of the disc. So this is all about look algorithm. Now we are going to the see look algorithm. See look algorithm is similar to CISCAN algorithm to some extent in this algorithm the arm of the disc moves out towards servicing request until it reaches the highest request cylinder. Then it jumps to the lowest request cylinder without servicing any request. Then it again start moving out towards servicing in the remaining request. It is different from CISCAN algorithm in the sense that CISCAN force the disc arm to move till the last cylinder regardless of knowing whether any request is to be serviced on that cylinder or not. See look is an enhanced version of both scan as well as look disc scheduling algorithms. This algorithm also uses the idea of wrapping the tracks as a circular cylinder as a CISCAN algorithm but the seek time is better than CISCAN algorithm. We know that CISCAN is used to avoid starvation and services all the request more uniformly the same goes for see look also. Let us see the steps of see look algorithm. First step is let request array represents an array storing indexes of the tracks that have been requested in ascending order of their time of arrival and head is the position of the disc head. Second the same initial direction in which the head is moving is given and it services in the same direction. Third the head services all the request one by one in the direction it is moving. First step the head continues to move in the same direction until all the request in this direction have been serviced. Fifth one is while moving in this direction the calculate the absolute distances of the tracks from the head. Six step is increment the total seek count with this distance. Seventh step is currently serviced track position now becomes a new head position means those serviced track is now become that original current position. Go to step five because we have to repeat the that and we reach the last request in this direction. And suppose if you reach the last request in the current direction then reverse the direction this is very important then reverse direction and move the head in this direction until we reach the last request that is needed to be serviced in this direction without servicing the intermediate requests means beach may there is no request we are going to handle ok. Reverse the direction and go to step three until all the request have not been serviced. Let us see all these steps with the help of example. In the silo algorithm the example is a disc contains two hundred tracks zero to one ninety nine request queue contains track number eighty two one seventy forty three one forty twenty four sixteen one ninety respectively current position of the head is given is fifty calculate the total number of tracks movement by red red head using the silo algorithm here again we have to calculate the red red head movement which is moving from one track to another and what is the total time taken for this movement. Again we assume direction is going towards a larger value means current position is fifty then we are moving to a larger value of the fifty again here see here current position is fifty we are moving larger value is eighty two then we are moving larger value after eighty two is one forty then we are moving larger value after one forty is one seventy then we are moving larger value after one seventy is one ninety then we are moving from 190 to directly reverse direction to the lower value without attending any request in between. The lower value of the 50 is what? 16, then 424, then 43, then 16 value greater is 24, 24 value is 43. So, this is your redacted stops here. Now, how much time is taken? 190 minus 50 plus 100 minus 16 plus 43 minus 16 is equal to 341 because we are moving in the same direction. So, we are taking calculate accordingly. So, the total time taken for moment of redacted head from one track to another is 341 nanosecond. So, very simple algorithm is there. See look and look algorithm and it is a conceptual algorithm which we use in the disc scheduling. How the redacted head moves from one track to another time? Now, the question is consider a disc cube with the request for IO2 block on cylinder 98, 183, 41, 122, 14, 124, 65, 67. The see look scheduling algorithm is used. The head is initially at cylinder number 53 moving towards larger cylinder numbers on servicing pass. The cylinder are numbered from 0 to 199. The total head movement in number of cylinder incurred by servicing this request is dash. Options are A3114, B332, C326, D372. Give the answer. Answer is 326. Yes, it is the correct answer. The total number of movement in number of cylinders incurred by servicing these request is 326 nanosecond. These are the references where I have taken. Thank you.