3

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

1 Answer 1

7

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? Commented Jun 20, 2017 at 2:55
  • @paul Related: stackoverflow.com/q/34959506/4941495 Commented Jun 20, 2017 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. Commented Jun 20, 2017 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? Commented Jun 20, 2017 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). Commented Apr 27, 2020 at 8:29

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.