I am bit confused with all this enteties and how they interconnected in Linux. "Unix internals" book states that
lightweight process (LWP)
In pthreads on Linux, the thread scheduling is handled by the kernel.
In Linux, a thread or process is created with the
clone() system call (
fork() is a special case of clone). Depending on the options passed to clone, the newly created process will be lighter weight or a heavier weight (i.e. having a separate memory space and a separate set of file descriptors etc.).
clone() with a minimum amount of separation.
It is also possible to not make use of native threads at all, and instead use a fully userspace implementation of threading, using
longjmp(). This could be used to implement some interpreted language, for example. However, I am not aware of a concrete example of a program or library that actually does implement its own userspace scheduler.
One more thing: a "kernel thread" is generally used to designate a thread that runs in kernel space, i.e. that is part of the kernel itself. In
ps such threads are recognisable because they are surrounded with square brackets, like