Because the kernel does not differentiate between processes and threads, kernel threads (kernel thread) are also called kernel processes (kernel process). Note that threads in normal processes cannot be understood as processes.
The difference between a kernel thread and a normal process:
1, the kernel thread only runs in the kernel state, the ordinary process can run in the kernel state and the user state.
2, the kernel thread can only call kernel functions, the normal process can call the kernel function through system calls.
3, the kernel thread can only run in the address space greater than page_offset, and the ordinary process can 4G address space (in addition to access to user space 3G, through system calls can access the kernel space 1G space).
Because kernel threads are not dragged by the user state context, they are often used by the kernel to perform important tasks such as refreshing the disk cache and exchanging different pages.
A process with the end of "D" seen in a Linux system with the PS–EF command is the kernel thread.
Kernel threads are created by Kernel_thread in the kernel state.
In Linux2.6.xxx/arch/arm/include/asm/processor.h
* * Create a new kernel thread
/
extern intkernel_ Thread (int (*FN) (void *), void *arg, unsigned long flags);
Parameter description:
fn: The function to be executed by the newly created kernel thread.
The ARG:FN parameters.
Flags: Similar to the role of Clone_flags in Do_fork. The CLONE_VM is used by default in Kernel_thread Do_fork.
See more highlights of this column: http://www.bianceng.cnhttp://www.bianceng.cn/OS/unix/