Kernel-level threads and user-level threads
When I wrote this blog these two days, I reviewed the operating system materials and encountered a problem that I did not understand before, that is, about kernel-level threads and user-level threads. After reading some documents, I will share my personal profile.
Threads have been implemented in many systems. By then, the implementation methods of various operating systems are different.
KST:
The kernel supports the implementation of threads in the core space. The kernel sets a thread control block for each thread in the core space, the information used to register the thread identifier, register value, status, priority, and other information. All operations on the thread, such as creation, undo, and switch, all are completed by the corresponding handler in the kernel through system function calls. The system that sets the kernel to support threads is scheduled in the thread unit.
Advantages:
ULT:
User-level threads exist only in user space and have nothing to do with the kernel. In terms of the kernel, it only manages conventional processes-single-threaded processes, but does not perceive the existence of user-level threads; each thread control block is set in the user space, and all operations on the thread are also completed by functions in the thread library in the user space, without the help of the kernel; if a user-level thread is set for a system, the scheduling is still in process units.
Combination Method:
The kernel supports the establishment, scheduling, and management of multiple KST threads. At the same time, user applications are allowed to create, schedule, and manage user-level threads. Some Kernel support threads correspond to multiple user-level threads, programmers can adjust the number of threads supported by the kernel based on application needs and machine configurations to achieve better results.
Comparison:
(1) Kernel support
(3) scheduling and thread execution time
(5) system call
Many of them are copied from the CC ppt. I hope it will help!