Hi,
On Wed Oct 03, 2007 at 06:35:28 +0900, Lin wrote:
It's the idle thread. It is running when no other activity is in the L4Linux system. It just sits there are waits for things to happen.
And more, What is the thread "l4lx.idler" used for ??
It wakes up the idle thread when work is to be done.
"l4lx.idler" is created by "l4lx.cpu0" in "l4x_idle" and its start function is "idler_func" (in "arch/l4/kernel/dispatch.c").
But this function only executes
while(1) l4_sleep_forever();
so I can't understand how "l4lx_idler" wakes up "l4lx_cpu0".
It seems to only sleep.
This thread sends exception IPCs to the idle thread upon request of interrupt threads. Its actual code does not matter.
(4) What does the function "l4x_user_dispatcher" do ? How to switch contexts in Linux and in L4 almost at the same time ? (in 3)
Context switching in L4 is done by the kernel (Fiasco). Also note that the L4Linux server itself runs in an L4 thread and thus Fiasco is doing context switches when switching from a user process (L4 thread) to the L4Linux server (another L4 thread). This basically happens when the IPCs are sent. The context switch in the other direction happens when the L4Linux server replies the user process. The context switches in the Linux server happen inside the schedule() call, the L4 side is not affected by this, as it basically only means that the Linux server switches to another stack.
- If Linux server gets IPC for some reasons, it wakes up and check the IPC sender. Then, if the sender is a thread corresponds to certain Linux task, Linux server wakes up this Linux task and reschedules by calling "schedule()".
I don't quite understand what you want to say. If the Linux server gets an IPC it has to handle this request (Pagefault, syscall...). If the Linux system wants to reschedule, schedule() is called so that another context may be selected.
I may have some misunderstanding...
Could you check the following things ?
(1) When a L4 thread which is runnig as a Linux task is scheduled by L4, is the Linux task ("task_struct" instance) corresponds to the L4 thread scheduled as "l4lx.cpu0" by Linux scheduler ? (Of course, "l4lx.cpu0" is not scheduled by L4 at this time.)
For example, there are two user processes A and B in Linux server now.
There are two threads (tasks) corresponds to A and B in L4, and there are two "task_struct" instances (both of them only execute the loop of "l4x_user_dispatcher") in Linux system.
When the L4 thread of A is running (scheduled by Fiasco), the context of "l4lx.cpu0" is "task_struct" of A.
If Fiasco switches the running thread from A to B, the context of "l4lx.cpu0" is changed to "task_struct" of B after ? (or no change ?)
In other words, are the active L4 thread of Linux process and the L4 thread the context of "l4lx.cpu0" corresponds to always the same ?
Fiasco can never switch from A to B directly as both are never ready at the same time. The switch order is always A -> Linux-server -> B. Besides that the active context of the Linux server always corresponds to the L4 thread currently active, as you already stated.
Adam