Types of Threads

 Types of Threads:    There are following thread types-

User-Level Threads: User-level threads implement in user-level libraries, rather than via systems calls, so thread switching does not need to call operating system and to cause interrupt to the kernel. In fact, the kernel knows nothing about user-level threads and manages them as if they were single-threaded processes.

Advantages:

1.      A user-level threads are fast and efficient.

2.      A user-level threads package can be implemented on an Operating System that does not support threads.

3.      User-level threads don’t require modification to operating system.

4.      Each thread is represented simply by a PC, registers, stack and a small control block, all stored in the user process address space.

5.      User level threads simple, they switching between threads and synchronization between threads can all be done without intervention of the kernel.

6.      Thread switching is not much more expensive than a procedure call.

 

Disadvantages:

 

1.      There is a lack of coordination between threads and operating system kernel.

2.       User-level threads require non-blocking systems call that is a multithreaded kernel. Otherwise, entire process will blocked in the kernel, even if there are runnable threads left in the processes.

Kernel-Level Threads: In this method, the kernel knows about and manages the threads. No runtime system is needed in this case. Instead of thread table in each process, the kernel has a thread table that keeps track of all threads in the system. In addition, the kernel also maintains the traditional process table to keep track of processes. Operating Systems kernel provides system call to create and manage threads.

Advantages:

1.      Kernel-level threads has full knowledge of all threads, Scheduler may decide to give more time to a process having large number of threads than process having small number of threads.

2.      Kernel-level threads are especially good for applications that frequently block.

Disadvantages:

1.      The kernel-level threads are slow and inefficient. For instance, threads operations are hundreds of times slower than that of user-level threads.

2.      Since kernel must manage and schedule threads as well as processes. It requires a full thread control block for each thread to maintain information about threads. As a result, there is significant overhead and increased in kernel complexity.

Comments

https://asp-net22-23.blogspot.com/

classification of operating System

What is an operating System

Functions of Operating System

Layered Systems

operating system components

Services Provided by Operating System

Batch Operating System