The native NPTL (native posix thread library) used on Linux maps pthreads to "processes that share resources and therefore look like threads" in the kernel. Thus, the kernel scheduler directly controls pthreads scheduling.
The "Pthread switch" is executed using the same code (in the kernel) that processes the process switches. Simplified, it will be something like "save the previous state of the process, if the next process uses a different virtual address space, and then switches the virtual address spaces, load the next state of the process"; (where "process status" includes an instruction pointer for the process / thread).
source
share