Kernel threads, lightweight processes, user threads

kernel thread

The kernel thread needs the support of the system kernel. Only the system kernel supports this kind of thread to talk about the kernel thread. The kernel thread only runs in the kernel mode and is not dragged down by the user mode context. The kernel thread can only be managed by the system kernel and is scheduled like a normal process. . A kernel that supports multithreading is called a multithreaded kernel.

Kernel threads can compete system-wide for processor resources, the only resources used are the kernel stack and space for holding registers on context switches .

lightweight process

Light-Weight Process ( LWP , Light-Weight Process ) is also a user thread, running in user mode, a user thread built on the system kernel and supported by the system kernel. It is a high abstraction of kernel threads, so lightweight processes need system kernel support, and the system kernel supports kernel threads. Each lightweight process is associated with a kernel thread, and lightweight processes are associated one-to-one with kernel threads.

User thread

User threads are threads that are completely built in user space. The creation, scheduling, synchronization, and destruction of user threads are all completed in user space, and neither the system kernel nor the system kernel supports kernel threads.

User threads based on lightweight processes

This thread also runs in user space, and the lightweight process acts as a bridge between user threads and kernel threads. Since this user thread is based on lightweight processes, it also needs system kernel support and system kernel support. kernel thread. The association between user threads and lightweight processes is a many-to-many association. This association is dynamic. From the perspective of user threads, multiple user threads are associated with one lightweight process.

Linux 's thread support uses this kind of thread. One-to-one association is used, one user thread corresponds to one lightweight process, and one lightweight process corresponds to one kernel thread.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326457195&siteId=291194637