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?

2
6

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

5
  • A process have many threads, does a kernel thread have many threads also?
    – paul
    Jun 20 '17 at 2:55
  • @paul Related: stackoverflow.com/q/34959506/4941495
    – Kusalananda
    Jun 20 '17 at 6: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. Jun 20 '17 at 7: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 8:29

Not the answer you're looking for? Browse other questions tagged or ask your own question.