Kernel Threads

Kernel threads are processes started directly by the kernel itself. They delegate a kernel function to a separate process and execute it there in "parallel" to the other processes in the system (and, in fact, in parallel to execution of the kernel itself).15 Kernel threads are often referred to as (kernel) daemons. They are used to perform, for example, the following tasks:

□ To periodically synchronize modified memory pages with the block device from which the pages originate (e.g., files mapped using mmap).

□ To write memory pages into the swap area if they are seldom used.

□ To manage deferred actions.

□ To implement transaction journals for filesystems. Basically, there are two types of kernel thread:

□ Type 1 — The thread is started and waits until requested by the kernel to perform a specific action.

□ Type 2 — Once started, the thread runs at periodic intervals, checks the utilization of a specific resource, and takes action when utilization exceeds or falls below a set limit value. The kernel uses this type of thread for continuous monitoring tasks.

The kernel_thread function is invoked to start a kernel thread. Its definition is architecture-specific, but it always uses the same prototype.

Continue reading here: Info

Was this article helpful?

0 0