[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Supervisor task switching



It is well known that MiNT stops switching tasks if one of them enters
supervisor mode. Because the system as well as various software relies on
it, its rather hardly possible to change the status quo (I think).
Anyways, its the easiest way to avoid preemption while the CPU is
executing kernel or TOS code.

At the other hand, it is a pain if someone wants to write a device driver
working fully in the background (for example, a hard disk I/O routine). If
I understand it correctly, even if such a driver accesses the hardware I/O
registers via an interrupt routine, its kernel interface code can't just
initiate the transfer and quit, because it has to wait for the result of
the operation. If I am right, MiNT device drivers are called by the kernel
in supervisor mode. So, if the driver is waiting for anything, the whole
system is also stopped.

So, I am thinking about an idea of expanding the MiNT scheduler so that
such supervisor tasks could be preempted under some circumstances. It
might be a global flag, setting of which would be a signal for the
scheduler that the current task should be preempted even if it is a
supervisor task. Alternatively, it could be a pointer to a kernel routine,
which routine, when entered, would switch tasks immediately without a
possibly 20 ms delay to the next scheduler 'session' :) Of course, the
supervisor task using these resources should be also responsible for doing
all safety stuff to prevent from being called again etc.

This is necessary for me to develop a background IDE driver for MiNT, or,
being more precise, to efficiently use the already existing Fenix IDE
driver under MiNT. Comments, objections are welcome.

Konrad M.Kokoszkiewicz
mail: draco@mi.com.pl
http://www.orient.uw.edu.pl/~conradus/
http://www.obta.uw.edu.pl/~draco/

** Ea natura multitudinis est,
** aut servit humiliter, aut superbe dominatur (Liv. XXIV,25)
*************************************************************
** U pospolstwa normalne jest, ze albo sluzy ono unizenie,
** albo bezczelnie sie panoszy.