A disk drive is disclosed which executes a rotational position
optimization (RPO) algorithm for selecting a next command to execute out
of a plurality of pending commands. The RPO algorithm comprises a first
phase and a second phase. The first phase of the RPO algorithm is
executed relative to a first priority and in response to at least one
non-real-time parameter. The second phase of the RPO algorithm is
executed relative to a second priority higher than the first priority and
in response to at least one real-time parameter.