Linux Kernel – Are Linux Kernel Threads Really Kernel Processes?

kernellinuxlinux-kernelprocessthread

I've read in many places that Linux creates a kernel thread for each user thread in a Java VM. (I see the term "kernel thread" used in two different ways:

  1. a thread created to do core OS work and
  2. a thread the OS is aware of and schedules to perform user work.

I am talking about the latter type.)

Is a kernel thread the same as a kernel process, since Linux processes support shared memory spaces between parent and child, or is it truly a different entity?

Best Answer

There is absolutely no difference between a thread and a process on Linux. If you look at clone(2) you will see a set of flags that determine what is shared, and what is not shared, between the threads.

Classic processes are just threads that share nothing; you can share what components you want under Linux.

This is not the case on other OS implementations, where there are much more substantial differences.