3

When using the top command on a linux server, I can see multiple root processes starting with the letter k, like for example kthreadd, kblockd, khelper, kacpi_notify, ksmd, kswapd0, khugepaged, ksmd and much more.

I assume it's not a coincidence; what does the k stand for here?

Blackwood
  • 3,184
Nicolas C
  • 253

1 Answers1

7

Those aren’t processes but kernel threads:

Threads are "light weight processes" (LWPs). [...]

[...]

Kernel-space threads often are implemented in the kernel using several tables (each task gets a table of threads). In this case, the kernel schedules each thread within the timeslice of each process. There is a little more overhead with mode switching from user->kernel-> user and loading of larger contexts, but initial performance measures indicate a negligible increase in time.

Advantages. Since the clocktick will determine the switching times, a task is less likely to hog the timeslice from the other threads within the task. Also I/O blocking is not a problem. Lastly, if properly coded, the process automatically can take advantage of SMPs and will run incrementally faster with each added CPU.

Related reading

user219095
  • 65,551