Using the Shortest-Seek-Time-First (SSTF) disk scheduling algorithm (where we select a request with a minimum seek time from the current head position), what happens if the requests in both directions from the current head position are equal?

For example, if the head position is at 25, and the nearest positions are 5 and 45, how do we determine which one to select?


  • $\begingroup$ yes,if a direction is given previously,then dont change it. $\endgroup$
    – user6656
    Jan 31 '13 at 19:53

Short answer: Depends on implementation.

Long answer: Ties could be broken randomly, or some fixed direction might be preferred. A popular strategy is to select that position first which does not require the head to change direction (since changing direction could take more time). So suppose that the head has moved from 20 to 25, it might prefer 45 next instead of 5 (since it was going towards the higher side). It could also depend on what the further instructions are going to be. Basically, the answer depends on what tie-breaking policy is selected in the implementation, and how complicated the implementation can be.

  • $\begingroup$ That makes perfect sense, thanks. The material I'm working off mentions that the head is 'working upwards through the cylinders' of the disk storage so I guess that would imply that if it's moving in an upwards direction then it would continue - since as you say changing direction could take more time). I didn't want to assume anything based on that material hence why I asked here. $\endgroup$ Dec 28 '12 at 21:58
  • $\begingroup$ @CiaranGallagher, that is not SSTF, but SCAN (head moves always up, if it reaches the end it moves to the start), This makes average access time longer, but more uniform (no unfair advantage to those sitting in the middle). But those are just extremely rough approximations at the (very complex!) workings of modern rotating disks. They have enough oomph to run a complete operating system on board, Heck, there is even a complete MINIX inside your current x86-64 CPU. $\endgroup$
    – vonbrand
    Feb 5 at 21:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.