What is User-level Threads?
- The user-level threads are implemented by users and kernel is not aware of the existence of these threads. It handles them like single-threaded processes.
- They are small and much faster than kernel level threads.
- They are represented by Progam Counter(PC), Stack, Rejisters and a small Process Control Block(PCB).
- There is no kernel involvement in synchronization for user-level threads.
Advantages of User-level Threads
- User-level threads are easier and faster to create than kernel-level threads. They can also be more easily managed.
- User-level threads can be run on any operating system
- There are no kernel mode privileges required for thread switching in user-level threads
Disadvantages of User-level Threads
- Multithreaded applications in user-level threads cannot use multiprocessing to their advantage.
- The entire process is blocked if one user-level thread blocked
What is Kernel-level Threads?
Kernel-level threads are handled by the operating system directly and the thread management is done by the kernel. The context information for the process as well as the process threads is all managed by the kernel. Because of this, kernel-level threads are slower than user-level threads.
Advantages of Kernel-level Threads
- Multiple threads of the same process canbe sheduled on different processors in kerel-level threads
- The kernel routines can also be multithreaded
- If a kernel-level thread is blocked, another thread of the same process can be sheduled by the kernel
Disadvantages of Kernel-level Threads
- A mode switch to kernel mode is required to transfer control from one thread to another in a process
- Kernel-level threads are slower to create as well as manage as compared to user-level threads.
Reference:
https://www.tutorialspoint.com/user-level-threads-and-kernel-level-threads