Sat Jan 18 15:43:04 CET 2020


So can this be used to introduce priorities in the CSP scheduler?

Suppose there is a chain of events that has a time constraint.  This
chain goes through a number of processes.  Likely, each process in
turn will unblock the next one.  What is the scheduling decision that
drives this?

There are only three points where a priority decision can be made:

- Take next element from hot list.  This can grow large if a single
  event has a cascading effect.

- For a particular channel, pick an element from the cold list.  In
  most cases this is just one, so this is not the most likely

- When waiting for multiple events, pick the highest priority one.

The first two are trivial: use ordered insert.

The latter is simple to implement: instead of picking first event in
select list, pick the corresponding task with highest priority.  It
involves a search.  Is it possible to re-arrange things such that this
can also be just an ordered insert?

Context: this still doesn't have pre-emption, but it could probably
accomodate "hot inserts", meaning that if an interrupt occurs, the
corresponding event should be inserted as soon as possible.

WFI->scheduler is not enough.  It needs to also perform the event.
For each buffer, it needs to perform a poll and add to the hot list.
Poll also needs to be repeated inside the scheduler in case of

If we need to poll on every event it becomes expensive.  It seems best
to use a single interrupt "stream", which is then treated as high

So the general story isn't simple.  Data structures will need to be
changed to allow priority, and interrupts need to be mapped to hot

Another: this isn't enough: we need to also pick a hot task based on
what task it will unlock, which is essentially priority inversion.
The priority of a hot task is the max between itself and the tasks it
will unlock, and all the way transitively.