Operating System (Complete Playlist)

Watch and track your favorite playlist.

Curated by: Gate Smashers (92 videos)


Currently Playing: L-6.6: SCAN Algorithm in Disk scheduling with Example | Operating System

In SCAN disk scheduling algorithm, head starts from one end of the disk and moves towards the other end, servicing requests in between one by one and reach the other end. Then the direction of the head is reversed and the process continues as head continuously scan back and forth to access the disk. So, this algorithm works as an elevator and hence also known as the elevator algorithm. #operatingsystem -------------------------------------------------------------------------------------------------------------------------------------- 🔹 Gate Smashers Shorts: Watch quick concepts & short videos here: https://www.youtube.com/@GSetgoofficial 🔹 Subscribe for more shorts and motivational content: https://www.youtube.com/@varunainashots ►Operating System (Complete Playlist): https://www.youtube.com/playlist?list=PLxCzCOWd7aiGz9donHRrE9I3Mwn6XdP8p Other subject-wise playlist Links: -------------------------------------------------------------------------------------------------------------------------------------- ►Design and Analysis of algorithms (DAA): https://www.youtube.com/playlist?list=PLxCzCOWd7aiHcmS4i14bI0VrMbZTUvlTa ►Database Management System: https://www.youtube.com/playlist?list=PLxCzCOWd7aiFAN6I8CuViBuCdJgiOkT2Y ► Theory of Computation https://www.youtube.com/playlist?list=PLxCzCOWd7aiFM9Lj5G9G_76adtyb4ef7i ►Artificial Intelligence: https://www.youtube.com/playlist?list=PLxCzCOWd7aiHGhOHV-nwb0HR5US5GFKFI ►Computer Networks (Complete Playlist): https://www.youtube.com/playlist?list=PLxCzCOWd7aiGFBD2-2joCpWOLUrDLvVV_ ►Computer Architecture (Complete Playlist): https://www.youtube.com/playlist?list=PLxCzCOWd7aiHMonh3G6QNKq53C6oNXGrX ►Structured Query Language (SQL): https://www.youtube.com/playlist?list=PLxCzCOWd7aiHqU4HKL7-SITyuSIcD93id ►Discrete Mathematics: https://www.youtube.com/playlist?list=PLxCzCOWd7aiH2wwES9vPWsEL6ipTaUSl3 ►Compiler Design: https://www.youtube.com/playlist?list=PLxCzCOWd7aiEKtKSIHYusizkESC42diyc ►Number System: https://www.youtube.com/playlist?list=PLxCzCOWd7aiFOet6KEEqDff1aXEGLdUzn ►Cloud Computing & BIG Data: https://www.youtube.com/playlist?list=PLxCzCOWd7aiHRHVUtR-O52MsrdUSrzuy4 ►Software Engineering: https://www.youtube.com/playlist?list=PLxCzCOWd7aiEed7SKZBnC6ypFDWYLRvB2 ►Data Structure: https://www.youtube.com/playlist?list=PLxCzCOWd7aiEwaANNt3OqJPVIxwp2ebiT ►Graph Theory: https://www.youtube.com/playlist?list=PLxCzCOWd7aiG0M5FqjyoqB20Edk0tyzVt ►Programming in C: https://www.youtube.com/playlist?list=PLxCzCOWd7aiGmiGl_DOuRMJYG8tOVuapB ►Digital Logic: https://www.youtube.com/playlist?list=PLxCzCOWd7aiGmXg4NoX6R31AsC5LeCPHe --------------------------------------------------------------------------------------------------------------------------------------- Our social media Links: ► Subscribe to us on YouTube: https://www.youtube.com/gatesmashers ►Subscribe to our new channel: https://www.youtube.com/@varunainashots ► Like our page on Facebook: https://www.facebook.com/gatesmashers ► Follow us on Instagram: https://www.instagram.com/gate.smashers ► Follow us on Instagram: https://www.instagram.com/varunainashots ► Follow us on Telegram: https://t.me/gatesmashersofficial ► Follow us on Threads: https://www.threads.net/@gate.smashers -------------------------------------------------------------------------------------------------------------------------------------- ►For Any Query, Suggestion or notes contribution: Email us at: gatesmashers2018@gmail.com

Video Transcript

Hello friends, welcome to Gate Smashers, the topic is SCAN algorithm in disk scheduling so here we start from the questions and here 200 tracks are already given in the disk 0 to 199 and I have the request queue these are the request which are already present in the queue current position is from 50 and now I am using the algorithm SCAN So how does the scan algorithm works? Lets start with the and here first of all I have 50 that is the current position of read write head and the scan algorithm is also called elevator algorithm where we have to move in one direction and and we have to move till last point in that direction so what does this mean? So here I have direction in this question, that is I think I forgot to write the direction direction you can take as lets say direction is towards the larger value You have been given like this, Lets say direction is towards larger value so from 50 we have to move towards larger value So if we move from 50 towards larger value so which value comes first? 82 So I covered 82 after 82 which is the next request coming? 140 and after 140 next request is 170 170 after 170, the next request I have is 190 So I want to say that after 50 here I have to move towards larger direction and while moving towards that direction what all the request that have come and you handle all those request means all the request what was it? 82, 140 170, 190 so I have handled all these requests means I will service all these request but this scan algorithm is called elevator algorithm because it will not go upto 190 only but will go upto 199, this means so the direction in which you are moving you have to move till the last point in that direction If you have in the question that you have to move from 50 towards the lower value so where will you go from 50 from 50 to 43 after 43 you move to 24 after 24 to 16 and after 16 upto 0 you have to go in the track number till the very last value. so here what is the larger value, which is given in the question so we first solve the according to the larger value so went to 199 now up to 199 we have covered all the values from 50 to 199 but after 199 now we are changing direction. now which value was less than 50 ? 43 so I’m covering 43 over here what is the value after 43 ? 24 so am covering 24 what is the value after 24 ? 16 so I am covering 16 and another point to keep in mind here stop here after coming to 16 now here you do not have to go to zero means to say this the work of the elevator means to go to the last in one direction but in the second direction , do not go to the very last have to go till the last request because after 16 there is no request in my queue ? in these cases, if the request was zero , you would have gone towards it whatever was the last request otherwise that is 16 , so I moved here and went to 16 so all you have to do is simply calculate here I have already told in earlier videos how to calculate in the CFSO and SSTF you don't need to calculate one by one if you want to do you can also calculate one by one otherwise 82-50 140 - 82 , 170- this and this but what is the best make the calculation easy 199-50 calculate at once (199 - 50) + (199 - 16) take out this value directly if you will solve it, the answer will come for you 332 and if the same question is given as that your direction is towards the lower value so from 50 you have to go to 24 , 16, 0 after zero you went whatever request is on your way now 82 ,140 what was next is 140 after 140 you have 170 the request after 170 is 190 but now take care, that you don't have to go till 199 the last value which was the last request has to be reached till that point but the direction in which you start ? you will have to move in that direction till the very last that is how the SCAN Algorithm works here somewhere comes a doubt that when the last request is 190 so why am I moving to 199 because it is working like an elevator and let's say I have ten floors in one building so maybe the last sequence which is till the 9th floor but why is she going till the 10th floor ? maybe a request comes dynamically at run time that me too or any other guy who is on floor 10 has pressed the button at run time if here I talk about the request this request is static it is good in static, if it does not goes to 199 then it is Ok but if we run it dynamically it is possible in real life that when you are moving in this direction then after 190 lets say in case a request came for upto 199 so it is best for you to move up to 199 in advance so that you get that advantage but there is also a disadvantage in it what is the disadvantage? The direction in which you are moving you went up to last and then changed the direction Once you changed the direction and after that in case a request comes dynamically if a request comes now the request is 195 so now you can't go to 195 because once you have changed the direction you have to come up to the last after this again you have to go up to 195 this means that if I am taking the case as static and most of the times in exam you will get the static case then in that case you don't need to take any tension you can solve this simply with this method but if we talk dynamically so here there may be a problem in the transaction but for the time being, its not necessary for you to remember this transaction Simply by using SCAN how do we find out the number of tracks how to find the number of read write movement, that is the most important part and there is also one more small point If read write head takes 1 Nanosecond to move from one track to another track then what is the total time means the time to go from one track to another track is 1 nanosecond so how much time the scan algorithm will take in total So what you have to do, first of all we will find out we are doing 332 movement means how much total movement the read write head is making 332, to service all these to cover all these so obviously, 332 x 1 NS that is 332 nanosecond which you can calculate easily This question is asked many times in extension The same questions is in FFCF and FCFS you can follow there too So this is all about the scan algorithm, Thank you!

Tracks in this Playlist