2

In Linux, a kernel thread have a PID:

enter image description here

Why is that? Is a kernel thread considered to be a process? And does a "normal" thread also have a PID?

paul
  • 121

1 Answers1

6

They are poorly named. Kernel threads in linux are processes (not actual threads) that run in kernel space rather than user space.

alzee
  • 240
  • A process have many threads, does a kernel thread have many threads also? – paul Jun 20 '17 at 02:55
  • @paul Related: https://stackoverflow.com/q/34959506/4941495 – Kusalananda Jun 20 '17 at 06:09
  • 1
    Kernel threads do not run in their own address space. Since the usual definition of a thread (vs. a process) is that related threads are executed in a shared address space, I think thread is a more appropriate term than process here. – Johan Myréen Jun 20 '17 at 07:08
  • @Johan Myréen A kernel thread has a PID as I have shown, but does a "normal" thread also have a PID? – paul Jun 20 '17 at 18:19
  • @paul - "Normal" thread too has a PID, which is inherited from the creator process/thread (the one that called pthread_create() to launch it). – FooF Apr 27 '20 at 08:29