[comp.lang.ada] Susan Flynn's remarks about task priorities

MFELDMAN@GWUVM.BITNET (Mike Feldman) (01/17/88)

First let me express my joy and satisfaction at the high technical plane
of the list these days. Now to the issue: Flynn asserts that the Ada
standard requires a pre-emptive scheduler, implying that a running task
must be interrupted by a ready-to-run task of higher priority. I have
always been under the impression that a "run-until-blocked" model was
legal, that is, that a _running_ task was not required to be interrupted
by another (even of higher priority) that merely became _ready_. On a
uniprocessor, for example, is the scheduler required to _interrupt_
all running tasks and reschedule just because one task's delay has
expired? Indeed, it seems possible that we won't even know the delay
has expired until the currently running task "goes to sleep" for
some reason.

The ALRM (p. 9-16) is a bit vague here:

  If two tasks with different priorities are both _eligible for execution_
  (emphasis mine) could be sensibly executed using the same physical proc-
  essors and the same other processing resources, then it cannot be the case
  that the task with the lower priority is executing while the task with
  the higher priority is not.

The question: what does the ALRM mean by "eligible for execution"? At what
point do we determine that the higher-priority task is eligible? Suppose
a lower-priority task has had control of the CPU and no timeslicing is in
effect; suppose that task doesn't do anything to block itself; suppose the
higher priority task was waiting on a delay which expires. Now - does the
paragraph above require that we immediately discover the "eligibility to
run"? I have always understood the answer was "no" - that the decision is
allowed to be deferred until the next "synchronization point". At _that_
point surely the higher-priority task will be scheduled.

BTW - I have never seen a clearly-stated definition of the points at
which - at a minimum - rescheduling _must_ be done. Clearly there are
many possibilities, like expiration of a time slice, that are definitely
_not_ required (timeslicing isn't required at all). But where are the
points at which rescheduling _is_ required? The closest I have come to it
in the ALRM is p. 9-18, in the section on ABORT, of all places (sect 9.10,
paragraph 6, too long to copy here). But this seems like an obscure place
to bury such an important point. Robert Firth (or whoever) - can you
comment for us? Susan, how about you?