I heard that on Linux / Unix, kernel threads (like system calls) run faster than user threads.
This is a rather inaccurate statement.
Kernel threads are used for background tasks internal to the kernel, such as handling interrupts and deleting data to disk. The bulk of system calls are handled by the kernel in the context of the process that called them.
Kernel threads are scheduled more or less in the same way as user processes. Some kernel threads have a higher default priority (in some cases, up to real-time priority), but they are said to be "faster to execute" misleading.
Is it true that on one processor field, when the user thread is launched, the kernel will be suspended?
Sure. Only one process can work per processor.
There are a number of situations where the kernel can interrupt a running task and switch to another (which may be the kernel):
- When the timer is interrupted. By default, this happens 100 times per second.
- When a task calls a lock system call (for example,
select() or read() ). - When a CPU error occurs in a task (for example, a memory access error).
source share