1
$\begingroup$

Using the elevator algorithm for processing disk requests, suppose requests arrive in the order: 8, 36, 34, 12.... (These numbers are cylinder numbers). Suppose the direction is UP meaning that the arm is taking on higher requests. Here we can see that both 36 and 34 are higher requests but 36 comes before 34, So, I'm confused if the algorithm addresses shortest distance between consecutive higher requests, because it was not addressed in the algorithm.

$\endgroup$
  • $\begingroup$ In my experience with elevators, I wouldn't even dare predicting what any elevator algorithm would do. I think Donald Knuth wrote that he spent some time observing an elevator where he worked, and never managed to figure out the algorithm used. $\endgroup$ – gnasher729 Apr 21 '18 at 19:07
  • $\begingroup$ @gnasher729 Just be clear, this question is about a disk scheduling algorithm named after elevators, not a model of how an actual elevator behaves. $\endgroup$ – Discrete lizard Apr 21 '18 at 21:11
1
$\begingroup$

The idea is that you guarantee that every request will be satisfied eventually by moving in one direction until there are no further requests in the same direction. The arrival order doesn't matter as much as the arrival times - any first request to an otherwise empty queue is scheduled immediately and set the direction. When that request is satisfied, look for additional requests in the same direction, then if none, reverse direction.

$\endgroup$
  • $\begingroup$ so in the above question, the request for 34 will only be proceeded only when the direction is reversed, right? $\endgroup$ – mathmaniage Apr 22 '18 at 2:38

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.