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
Harald,
I think you might be confusing (external) preempters with user-level schedulers. This is arether excusable, as these things are not clearly differentiated in the reference manuals (and preempters are not explained anywhere).
A user-level schedulers is a thread running at high priority and donating time slices to threads it wants to schedule. Other sections of the manuals refer to a thread's scheduler meaning a thread performing thread_schedule() syscalls on the former thread.
A preempter is a different thing: if a thread's time slice expires its preempter (if it exists) receives a (preemption) IPC notifying it of the fact that the former thread has been de-scheduled.
External preempters are not implemented in any L4 version at this time, mostly because their operation is not yet well enough defined (and, in fact, there are some problems with the whole concept).
Gernot
-- Gernot Heiser ,--_|\ School of Computer Sci. & Engin. Phone: +61 2 9385 5156 / \ The University of NSW Fax: +61 2 9385 5995 _,--._* Sydney, Australia 2052 E-mail: G.Heiser@unsw.edu.au v http://www.cse.unsw.edu.au/~gernot PGP fingerprint = 94 1E B8 28 25 FD 7C 94 20 10 92 E5 0B FF 39 8F
l4-hackers@os.inf.tu-dresden.de