Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Linux Pthreads User level or kernel level [duplicate]

Possible Duplicate:
how are pthreads on linux seen by scheduler

Are Linux pthreads user level threads or Kernel level threads ?

like image 308
Bandicoot Avatar asked May 11 '26 09:05

Bandicoot


1 Answers

The Linux kernel schedules threads rather than processes. As far as the scheduler is concerned, processes are now an artificial construct mostly for userland purposes.

When you create a process, it is a single thread where the thread ID (the kernel actually refers to this as a PID but that might be confusing so I'll refer to it as a TID here) and thread group ID (TGID) are identical.

If a thread creates a new thread (rather than a new process), it inherits the TGID from the creator, but gets a new TID.

In other words, the thread group can be considered the process, but the scheduler doesn't care - it works on individual threads.

So, in answer to your specific question, they're kernel-level threads.

like image 94
paxdiablo Avatar answered May 14 '26 14:05

paxdiablo



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!