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.

asked Apr 21, 2018 at 15:56
$\endgroup$
2
  • $\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$ Commented Apr 21, 2018 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$ Commented Apr 21, 2018 at 21:11

1 Answer 1

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.

answered Apr 21, 2018 at 19:50
$\endgroup$
1
  • $\begingroup$ so in the above question, the request for 34 will only be proceeded only when the direction is reversed, right? $\endgroup$ Commented Apr 22, 2018 at 2:38

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.