Hello friends,

welcome to the Gate Smashers the topic is shortest seek time first, in

disk scheduling algorithm now let's understand with the question here already it is given 200 tracks in one

disk and this is the request queue Now this request queue I have to service Means I have to respond to these

all one by one Current position of the read write

head is 50 So already I have denoted this in this

manner although we know that the tracks are in

circular shape but, to solve this numerical it is best

that you solve it this way 0 to 199, we have represented all the

tracks over here 50 is the current position means at this moment the read write

head is at 50 now here i have to use shortest seek time

first algorithm and this one is the request queue means at a point in request queue, these

request have already come now how the shortest seek time works i am standing here at 50 what is the meaning of shortest seek time means seek time is least what is the seek time, time taken to come

to desired track what is the meaning of desired track means i have to move to any track from 50 but that track should be shortest shortest does not mean the shortest value,

it should be nearest to 50 so if i talk here, which one is

nearest to 50, 43 shortest does not mean that you pick

up the value 16 do not have to pick shortest value,

shortest seek time means, from 50 where can i reach first if i start from 50, where can i reach first

..43 because 43 is nearest to 50 then after 43 now i have reached to 43 from 43 where can i reach nearest,

so that seek time is least So from 43 to 24 So I've moved from 43 to 24 means from the value where you have to

reach ..and from where you are starting means destination minus source Or you can also find by doing source minus

destination If I talk here I'm at 50 So what is the difference between 50 and 43

..7 And if I take value more than 50 then

obviously the value will come more than 7 so we have to follow according to this Now I'm standing at 43 and and which one

is nearest to 43..24 And after 24 which one is nearest That is 16 means this request of mine has completed Now anything is coming in this direction?

no it's not coming Then obviously after that,

which one is nearest to 16 Nearest to 16 is 82,

although 82 it is not nearest And if I see, 82 is left, 170 left,

140 is left, 190 is left and among them if we see 82 is the nearest

to 16 Then there is no option I have to go to 82 I serviced truck number 82 After that which one is nearest to 82..

140 Then I went to 140 and I serviced the 140

track After 140, 170 I picked the data from track number 170 After that the last point is 190 sorry 190 This is the last value So this is how you have to follow the

shortest seek time first Just have to follow the value whichever is

nearest to that value And if I talk about the time over here So the method is same Either 50 minus 43 43 plus 43 minus 24 Plus 24 minus 16 plus 82 minus 16 Plus 140 minus 82 Plus 170 minus 40 plus 190 minus 170 And before in FCFS video also i have

told you that it is not necessary that you have to

calculate all these values like this You can do direction wise

what is the meaning of direction So when I started from 15, then we moved

till 16 without any change in direction so instead of doing these many

calculations You do it easily 50 minus 16, That you will calculate in first attempt

only so if you will calculate in first attempt Then one two three, all these three

calculations will be inside this So there is no need to do these long

calculations, you save your time here Now after 16 the direction is changed Because before I was moving there now

I'm moving here Now from here you have to go till the very

last point in between that direction has never

changed Then which one is the last point…190 then you directly find out 190 minus 16 So all these values will be covered within

it only So if you will calculate it the answer

will come out to be 208 So if I talk about the shortest seek time

first what is the advantage of this First of all it tries to give the optimal

result Means it tries to give you result of

shortest seek time But on an average cases It may be that

it may create worst result But what is the method of shortest seek

time first From wherever point where we are starting

we have to go to the nearest track number And we have to move one by one And the second advantage over here is

that the response time Response time means A request which entered in the queue

after how much time What are you doing to it, in a way we

are initiating it So almost every worst we are trying to

initiate it quickly So the response time and the average

response time is coming good But the problem is starvation What is the problem we are facing due to

starvation It may be that one request is waiting for a

long time, for its turn So if I see a simple example here So if the requests are coming Let's say I'm standing on 50 from 50 next request came 40 So I moved to 40 So after 40 the next request is or

if I write the request sequence 40, after 40 I'm getting the request 61 Let's say after 61 the request came is 30

20 10 so if my requests are in this sequence just

for the example we are taking I moved from 50 to 40,

after 40 whose turn was next, 61 Because 61 is far away as compared to 30 Then who is nearest 40,..30 After 30 where will I go, ..20

after 20 I moved to 10 means the value 61 will have to wait

for a long time that first it will complete till 10 then

its turn will come So this is the problem that occurs in the

shortest seek time first That is called the starvation Except starvation there is also one problem Although it tries to give the optimal

result Advantage is there and performance

is also in a way good seek time is also coming less But what is the problem here But over here the overhead is generating What is overhead,

firstly you will have to find Which one is nearest to 50 Means in the whole list which one is the

nearest value to the 50 there you have to go first then let's say i reached Then which one is nearest to 40 then from n minus 1 which one is

nearest to 40 and then from n minus 2 which one is

nearest to 30 Means in every step you will have to find

who is the nearest to that particular value So due to this the complexity gets

increased So overhead is increasing, this is all

about the shortest seek time first