> Can anyone explain how linux schedules kernel-space threads created with
AFAIK they are created with kernel_thread() not clone().
> Do kernel-space threads behave the same as normal linux processes, in terms
> of scheduling I mean? Are they scheduled in the same way as normal processes
> are and is their scheduling done by the same scheduler?
They are scheduled in the same way as all other processes.
You just have to note that a process will not be preempted
while it is in kernel mode. Userspace processes can switch
between kernel and user mode while a kernel thread is
always in kernel mode.
A process in kernel mode can give up the CPU by calling
the schedule() function. It can also be preempted when it
returns to userspace, the current->need_resched flag is
set when that has to happen.
> Does every created kernel-space thread have it's own task_struct created and
> added in kernel's process list for scheduling? What is the role of
> thread_struct inside task_struct of every process and has it anything to do
> with thread scheduling?
There is a task_struct for each process, that includes
userspace processes, kernel processes and iddle processes.
I think the thread_struct contains the architecture
dependend parts of the task_struct.
> Best regards,
> Mario Zagar