4,158 views

1 Answer

1 votes
1 votes

 

User-level threads Kernel-level threads
The existence of user- level threads is unknown to the kernel. The existence of the kernel-level threads is known to the kernel.
User-level threads are managed without kernel support. Kernel-level threads are managed by the operating system.
user-level threads are faster to create than are kernel-level threads. Kernel-level threads are user-level threads.
User-level threads are scheduled by the thread library.

Kernel-level threads are scheduled by the kernel.

 

 

Circumstances where kernel-level threads are better than user-level threads:

  • If the kernel is single-threaded, then kernel-level threads are better than user-level threads, because any user-level thread performing a blocking system call will cause the entire process to block, even if other threads are available to run within the application.

  • For example a process P1 has 2 kernel level threads and process P2 has 2 user-level threads. If one thread in P1 gets blocked, its second thread is not affected. But in case of P2 if one thread is blocked (say for I/O), the whole process P2 along with the 2nd thread gets blocked.

  • In a multiprocessor environment, the kernel-level threads are better than user-level threads, because kernel-level threads can run on different processors simultaneously while user-level threads of a process will run on one processor only even if multiple processors are available.

Circumstances where user-level threads are better than kernel-level threads:

  • If the kernel is time shared, then user-level threads are better than kernel-level threads, because in time shared systems context switching takes place frequently. Context switching between kernel level threads has high overhead, almost the same as a process whereas context switching between user-level threads has almost no overhead as compared to kernel level threads.

Related questions

0 votes
0 votes
0 answers
1
akash.dinkar12 asked Mar 19, 2019
195 views
What resources are used when a thread is created ? How do they differ from those used when a process is created ?
0 votes
0 votes
0 answers
2
akash.dinkar12 asked Mar 19, 2019
273 views
Describe the actions taken by a kernel to context-switch between kernel level threads.
0 votes
0 votes
0 answers
3
akash.dinkar12 asked Mar 19, 2019
250 views
Provide two programming examples in which multithreading provides better performance than a single-threaded solution.