Skip to main content
Engineering LibreTexts

4.2: Thread Types

  • Page ID
    46802
  • Threads and its types in Operating System

    Thread is a single sequence stream within a process. Threads have same properties as of the process so they are called as light weight processes. Threads are executed one after another but gives the illusion as if they are executing in parallel. Each thread has different states. Each thread has

    1. A program counter
    2. A register set
    3. A stack space

    Threads are not independent of each other as they share the code, data, OS resources etc.

    Similarity between Threads and Processes –

    • Only one thread or process is active at a time
    • Within process both execute sequentiall
    • Both can create children

    Differences between Threads and Processes –

    • Threads are not independent, processes are.
    • Threads are designed to assist each other, processes may or may not do it

    Types of Threads:

    1. User Level thread (ULT)
      Is implemented in the user level library, they are not created using the system calls. Thread switching does not need to call OS and to cause interrupt to Kernel. Kernel doesn’t know about the user level thread and manages them as if they were single-threaded processes.

      Advantages of ULT

      • Can be implemented on an OS that does’t support multithreading.
      • Simple representation since thread has only program counter, register set, stack space.
      • Simple to create since no intervention of kernel.
      • Thread switching is fast since no OS calls need to be made.

      Disadvantages of ULT

      • No or less co-ordination among the threads and Kernel.
      • If one thread causes a page fault, the entire process blocks.

          Difference between Process and User Level Thread:

    PROCESS USER LEVEL THREAD
    Process is a program being executed. User level thread is the thread managed at user level.
    It is high overhead. It is low overhead.
    There is no sharing between processes. User level threads share address space.
    Process is scheduled by operating system. User level thread is scheduled by thread library.
    Blocking one process does not affect the other processes. Blocking one user Level thread will block whole process of the thread.
    Process is scheduled using process table. User level thread is scheduled using thread table.
    It is heavy weight activity. It is light weight as compared to process.
    It can be suspended. It can not be suspended.
    Suspension of a process does not affect other processes. Suspension of user level thread leads to all the threads stop running.
    Its types are – user process and system process. Its types are – user level single thread and user level multi thread.
    Each process can run on different processor. All threads should run on only one processor.
    Processes are independent from each other. User level threads are dependent.
    Process supports parallelism. User level threads do not support parallelism.
    1. Kernel Level Thread (KLT)
      Kernel knows and manages the threads. Instead of thread table in each process, the kernel itself has thread table (a master one) that keeps track of all the threads in the system. In addition kernel also maintains the traditional process table to keep track of the processes. OS kernel provides system call to create and manage threads.

      Advantages of KLT

      • Since kernel has full knowledge about the threads in the system, scheduler may decide to give more time to processes having large number of threads.
      • Good for applications that frequently block.

      Disadvantages of KLT

      • Slow and inefficient.
      • It requires thread control block so it is an overhead.

          Difference between Process and Kernel Thread:

    PROCESS KERNEL THREAD
    Process is a program being executed. Kernel thread is the thread managed at kernel level.
    It is high overhead. It is medium overhead.
    There is no sharing between processes. Kernel threads share address space.
    Process is scheduled by operating system using process table. Kernel thread is scheduled by operating system using thread table.
    It is heavy weight activity. It is light weight as compared to process.
    It can be suspended. It can not be suspended.
    Suspension of a process does not affect other processes. Suspension of kernel thread leads to all the threads stop running.
    Its types are – user process and system process. Its types are – kernel level single thread and kernel level multi thread.
    • Was this article helpful?