Friday, September 5, 2014

Linux Kernel Thread


These are standard processes exist solely in kernel space.  The kernel threads do not have an address space (mm pointer is NULL).  They operates in kernel space and does not switch into user space.  Kernel threads are scheduled together with user threads.

A kernel thread can only be created by another kernel thread using

int kernel_thread(int (*fn) (void *), void * arg, unsigned long flags)

which return a pointer to the child task_struct.  The child thread exect fn with arguments passed in arg.

The child kernel thread is created using the usual clone() call with CLONE_KERNEL, CLONE_FS, CLONE_FILES and CLONE_SIGHAND.

No comments: