About external preempters

Harald Fritzsche Harald.Fritzsche at mpd.de
Sun Jan 3 15:38:41 CET 1999


Hello,

it seems to me that external preempters are usefull for future use?
So i have grabbed some information from the list and other sources.


> [SH: S. Houidek]Hello,
>
>        I have finished reading the L4/x86 reference manual,
>        and I have some questions about preempters :
>
>        (1) What are the exact purposes of external and
>        internal preempters ?

(See the L4 User manual from http://www.cse.unsw.edu.au/~disy/.)

There exist (exclusivly?) only one internal preempter, wich is invoked
after each timer interupt if the timesclice of running thread is expired

or if it is called directly by kernel or user (l4_thread_switch or
similar).
This internal preempter is essential for the system itself.
The scheduling is done by the thread_t::schedule() funtion in fiasco.

External preempter: That is not a really preempter, its a user level
scheduler.
The preemption is done by the kernel described above. The External
preempter
is scheduled by the kernel if no task/thread with higher priority is
ready.
The intended purpose of an external preempter is to refine the kernels
scheduling method with any user level method. There are 2 syscalls
intended
for use in external preempters, (i) l4_thread_switch and
(ii) l4_thread_schedule.

There are 5 variables, 1(3) syscall(s) and 1 ipc related
to preemption/scheduling:
(1) time_slice
(2) priority
(3) maximum controlled priority
(4) external preempter (set by l4_thread_schedule, but not yet used?)
(5) internal preempter (set by l4_ex_regs, but never used?)
(6) l4_thread_switch
(7) Preemption RPC (mentioned in the L4 Reference manual, but not
implemented,
     see below)

>        (2) What differenciate them from scheduling tasks ?
>
>        (3) What is the flow of control, from kernel to elected thread,

>        at time quantum exhaustion ?

Needs to be defined?

>        (4) What is the role of the L4 internal scheduler, in the
presence
>        of scheduling tasks ?

[from another thread:]
>> L4 or L4Linux does not use external preempters?

>[JW]No, since there is currently no implementation of this concept.
There
>are some problems with clans&chiefs if you handle 'time slice faults'
>(preemption) via ipc. I don't know whether fiasco will provide the
>first implementation for external preempters, at least we are thinking
>about it.

An external preempter has to do at least 3 things:
(1) user level scheduling,
(2) waits on a kernel side IPC indicating time slice expiration,
(3) communication with connected threads
 (i) inserting/deleting of threads in the user level queues
 (ii) additional support, time slice and priority changes, etc..

Is there a way to emulate the time slice expiration IPC?

The following way may work:

As noted in L4 User Manual the External Preempter runs with a higher
priority than all other tasks which are scheduled by this external
preempter.
That means that the external preempter is always scheduled before any
other
task under control of this external preempter. So the external preempter

is able to calculate the time consumed by a thread before the preempter
calls
l4_thread_switch to switch to the next task. This calculation can
emulate
the information given by a time slice expiration fault.

Further questions are:
Who is invoking an external preempter? (rmgr?)
Where gets the preempter memory, needed by dynamical sized queues?
 Does the function ::new() work inside a L4 task, or what is to do to
bring
 ::new() in operation?

So far my questions.

Regards and a happy new year
Harald Fritzsche




More information about the l4-hackers mailing list