User Level and Kernel Level Threads

User Level Threads

  • User-level threads are implemented by user level thread libraries rather than by using system calls.
  • The kernel is not aware of any such threads and independent of the operating system
  • Thread switching does not need to call system calls and to cause an interrupt to the kernel.
  • There will be only one Thread Descriptor(TD) for all the threads.
  • Example: Java Thread and POSIX Threads

Advantage of User Level Thread:

  • They do not require modification to the OS, they can be created on OS that does not support threads.
  • Thread switching(context switching) is not much expensive, without the need for kernel intervention.
  • Thread is represented by program counter(PC), Registers, Stack and, a small Thread Control Block(TCB).

Disadvantage of User Level Thread:

  • There is a lack of coordination between threads and the operating system kernel. Therefore, the process as a whole gets one time slice irrespective of whether a process has one thread or 1000 threads within. It is up to each thread to relinquish control to other threads.
  • User-level threads require non-blocking systems call. Otherwise, the entire process will be blocked in the kernel, even if there are runnable threads left in the processes.
  • For example, if one thread causes a page fault, the process blocks, as there is only one thread descriptor(TD) for all the threads.

Diag-1: User Level Threads

Kernel Level Threads:

  • These threads are implemented by the operating system by using system calls.
  • The kernel has a table that keeps track of all threads in a system.
  • There will be one thread Descriptor(TD) per thread unlike user level threads

Advantages of Kernel Level Threads:

  • Because kernel has full knowledge of all threads, scheduler may decide to give more time to a process having a large number of threads than a process having a small number of threads.
  • As each threads have its own thread descriptor(TD), thus even if one thread gets blocked, other thread can continue executions.

Disadvantages of Kernel Level Threads:

  • The kernel-level threads are slow and inefficient. For instance, kernel thread operations are hundreds of times slower than that of user-level threads.
  • Since kernel must manage and schedule threads as well as processes. It requires a full thread control block (TCB) for each thread to maintain information about threads, as a result there is significant overhead and increased in kernel complexity

Examples of Kernel Level threads

  • The Idle process is a kernel thread:
    When a ready queue is empty then the scheduler schedules idle process, there is one idle thread per process in modern OS
  • Page Daemon:
    Responsible for page stealing from use-space process when system space memory is low.

Diag-2: kernel Level Threads

This image has an empty alt attribute; its file name is kernel-level-thread-1.jpg

A relevant post to Thread

Categories: Operating system (OS)

4 replies


  1. Index of Operating System - Tech Access
  2. Characteristics of a Thread - Tech Access
  3. Pros and Cons of Thread - Tech Access
  4. Process vs Thread - Tech Access

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: