28 votes 28 votes A disk has $200$ tracks (numbered $0$ through $199$). At a given time, it was servicing the request of reading data from track $120$, and at the previous request, service was for track $90$. The pending requests (in order of their arrival) are for track numbers. $30 \ 70 \ 115 \ 130 \ 110 \ 80 \ 20 \ 25.$ How many times will the head change its direction for the disk scheduling policies SSTF(Shortest Seek Time First) and FCFS (First Come First Serve)? $2$ and $3$ $3$ and $3$ $3$ and $4$ $4$ and $4$ Operating System gateit-2004 operating-system disk-scheduling normal + – Ishrat Jahan asked Nov 2, 2014 edited Dec 21, 2019 by Arjun Ishrat Jahan 10.2k views answer comment Share Follow See all 3 Comments See all 3 3 Comments reply One commented Jan 21, 2017 i edited by One Jan 24, 2017 reply Follow Share Ans is C)3,4 0 votes 0 votes zeeshanmohnavi commented Dec 4, 2018 reply Follow Share Why is track 90 considered as the starting point of the head, when it is clearly mentioned to be the position of the head at an earlier request, and the requirement uses the term "how many times will the head change its direction"? This information, in the question, could very well be redundant, given just to confuse the candidates. 0 votes 0 votes palashbehra5 commented Sep 2, 2021 reply Follow Share @zeeshanmohnavi The starting point of the head is at 120, the previous was 90, which means the head was travelling in the MAX direction. This info is useful as if the next request is to be serviced in the MIN direction, it will be counted as a “change in direction” of the head. 5 votes 5 votes Please log in or register to add a comment.
Best answer 48 votes 48 votes Answer is (C) SSTF: $(90) \ 120 \ 115 \ 110 \ 130 \ 80 \ 70 \ 30 \ 25 \ 20$ Direction changes at $120,110,130$ FCFS: $(90) \ 120 \ 30 \ 70 \ 115 \ 130 \ 110 \ 80 \ 20 \ 25$ direction changes at $120,30,130,20$ Sandeep_Uniyal answered Jan 17, 2015 edited Jun 19, 2018 by kenzou Sandeep_Uniyal comment Share Follow See all 15 Comments See all 15 15 Comments reply skrahul commented Jan 26, 2015 reply Follow Share have to consider direction change at starting point..? 0 votes 0 votes Ashis Kumar Sahoo commented Jan 31, 2015 reply Follow Share yes, of course. 0 votes 0 votes Rajarshi Sarkar commented Apr 6, 2015 reply Follow Share The question says: How many times will the head change its direction?At the starting point the head was stationary, why should we take into consideration the head's first movement as a direction change? 3 votes 3 votes Arjun commented Apr 6, 2015 reply Follow Share explicitly mentioned in question "it was servicing the request of reading data from track 120, and at the previous request, service was for track 90" So, head was not stationary. 21 votes 21 votes Rajarshi Sarkar commented Apr 6, 2015 reply Follow Share okay, missed that! 0 votes 0 votes Arjun commented May 14, 2015 reply Follow Share Then the question becomes ambiguous. Because to say if direction is changed, we need to know the current direction. If not given, I would assume the current direction is from 0 - the current track. 9 votes 9 votes Vijay Thakur commented Oct 14, 2016 i edited by Vijay Thakur Oct 14, 2016 reply Follow Share yes C is answer 0 votes 0 votes nikunj commented Sep 12, 2017 reply Follow Share when we serviced 110 then it changed its direction to service 130 but why ? from 110 distance to 130 is 20 (right of 110)and from 110 distance to 90 is also 20 (left of 110) both side we are having equal seek time and additional overhead of changing direction as well if we go with 130 0 votes 0 votes gari commented Dec 2, 2017 reply Follow Share @nikunj I also have the same doubt.sstf gives 2 changes in best case But I think as we fix fcfs as 4 so option C and D are there. So we have to go with c... 0 votes 0 votes gauravkc commented Dec 2, 2017 reply Follow Share Where is 90? 0 votes 0 votes suraj20041995 commented Dec 7, 2017 reply Follow Share There isn't any pending request for 90. check once again. 0 votes 0 votes Miny commented Mar 23, 2019 reply Follow Share i have one doubt, in sstf, while serving from 90 to 120, 110 and 115 are already covered, so why are we covering them again 1 votes 1 votes Sanjay Sharma commented Dec 8, 2020 reply Follow Share those requests haven’t arrived till then 1 votes 1 votes Deepti Patel commented Dec 14, 2022 reply Follow Share I have a doubt here: When r/w head is at 110 why it moved to 130, it should move to 90 because they both are at same distance away from 110, and the head will prefer not to change direction if there is tie between 2 distances? So the answer for SSFT should be 2 and not 3: Direction changes at: 120, 20. 1 votes 1 votes _Shubham_.Singh_ commented Aug 16, 2023 i edited by _Shubham_.Singh_ Aug 16, 2023 reply Follow Share @Deepti Patel because request 90 was already serviced. 0 votes 0 votes Please log in or register to add a comment.
14 votes 14 votes Ans C) 3,4 Tuhin Dutta answered Apr 11, 2018 Tuhin Dutta comment Share Follow See all 0 reply Please log in or register to add a comment.
5 votes 5 votes Here it is mentioned in the question that the disk was servicing request from track 120 and previously it has serviced track 90 so from 90 to 120 it must move in one direction (lets consider this direction -->) then from 120 it must read 115(SSTF) which is in (<---) direction. So the answer is C. Pradyumna Paralikar answered Apr 6, 2015 Pradyumna Paralikar comment Share Follow See all 0 reply Please log in or register to add a comment.
0 votes 0 votes According to Shortest Seek Time First: 90-> 120-> 115-> 110-> 130-> 80-> 70-> 30-> 25-> 20 Change of direction(Total 3); 120->15; 110->130; 130->80 According to First Come First Serve: 90-> 120-> 30-> 70-> 115-> 130-> 110-> 80-> 20-> 25 Change of direction(Total 4); 120->30; 30->70; 130->110;20->25 topper98 answered Mar 23, 2020 topper98 comment Share Follow See all 0 reply Please log in or register to add a comment.