Difference between User Level Thread and Kernel Level Thread
There are two types of threads in operating systems:
1. User Level Thread
2. Kernel Level Thread
User Level Thread:
This type of thread is loaded entirely in user space, the kernel knows nothing about them. When threads are managed in user space, each process needs its private thread table. The thread table consists of the information on the program counter, stack pointer, registers, state, etc. The thread table is managed by the run-time system. When a thread is moved to a ready state or blocked state. The information needed to restart it is stored in the thread table.
Kernel Level Thread:
In Kernel Level Thread, the kernel does the total work of thread movement. There is no thread table in each process. The kernel has a thread table that keeps track of all the threads in the system. When a thread wants to create a new thread or destroy any existing thread, it makes a kernel call which takes the action.
The kernel’s thread table holds each thread’s registers, state and other information. The information is the same as with user-level threads, but it is now in the kernel instead of user space.
User Level Thread vs Kernel Level Thread:
1. It provided at the user level is referred to as user level thread. | 1. It provided provided by kernel is referred to as Kernel level thread. |
2. User level thread support called many-to-one mapping thread. | 2. Kernel level thread support one-to-one mapping thread. |
3. It's Context switch time is less | 3. It's Context switch time is more |
4. User level threads are faster than kernel level thread | 4. Kernel level threads are slower than user level thread |
5. User Level Threads can run on any operating system | 5. Kernel level threads are specific to the operating system |
6. User level threads do not invoke the system calls for scheduling | 6. Kernel level threads are constructed and controlled by system calls |
7. Example of User level thread libraries - POSIX Pthreads, Mach C-threads | 7. Example of Kernel level thread libraries - Windows NT, Solaris |