Linux kernel scheduling of kernel-space thread - question

Linux kernel scheduling of kernel-space thread - question

Post by Bilbo Baggi » Wed, 05 Sep 2001 22:18:02



Hello!

Can anyone explain how linux schedules kernel-space threads created with
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?

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?

Thanx,

Best regards,                        

                                        Mario Zagar                        

 
 
 

Linux kernel scheduling of kernel-space thread - question

Post by Kasper Dupon » Wed, 05 Sep 2001 23:34:47



> Hello!

> Can anyone explain how linux schedules kernel-space threads created with
> clone()?

AFAIK they are created with kernel_thread() not clone().

Quote:

> 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.

Quote:

> 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.

> Thanx,

> Best regards,

>                                         Mario Zagar


--
Kasper Dupont

 
 
 

1. Linux kernel scheduling of kernel-space threads - question

Hello!

Can anyone explain how linux schedules kernel-space threads created with
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?

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?

Thanx,

Best regards,

                        Mario Zagar

2. fvwm95 freezes up

3. kernel thread VS user space thread in linux

4. Concantination disks?

5. Synchronizing user space threads with kernel space in linux

6. awk number comparisons

7. Thread priority scheduling across linux kernels.

8. $&%^*&(* -C option on the lpr command

9. are pthreads kernel-space threads?

10. Kernel-space Threads

11. HELP:kernel thread scheduling

12. forking of kernel threads and scheduling

13. HELP: Kernel thread scheduling