Solution (source code)

= Solution

The previous motion from 135 to 133 fixes the initial direction as downward. Under <SCAN disk scheduling>, the head continues to the physical endpoint 0 before reversing:
``
133 -> 112 -> 97 -> 91 -> 76 -> 23 -> 0 -> 135 -> 142 -> 157
``
Thus \b[SCAN crosses $133+157=290$ tracks], stopping once the final pending request has been served.

If “elevator” means <LOOK disk scheduling>, reversal occurs at the lowest pending request, 23, rather than track 0. Its route omits 0, and the total is \b[$(133-23)+(157-23)=244$ tracks]. Stating the turnaround convention is necessary to make the numerical answer unambiguous.

\Image[/past-exam-of-the-year-1-of-the-computer-science-course-of-the-university-of-oxford/2016/digital-resit-disk-scheduling.png]
{title=<Disk scheduling> service paths and the SCAN–LOOK turnaround distinction}
{description=Original paths from the given starting position. The extra zero-track endpoint in SCAN is a movement step rather than a serviced request. Totals measure absolute track displacement.}