Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java's or C#'s Threads are based on User-Space Threads or Kernel-Space Threads?

Are Java's and C#'s Threads based on User-Space Threads or Kernel-Space Threads?

like image 845
devoured elysium Avatar asked Nov 12 '10 01:11

devoured elysium


2 Answers

In C#, threads are OS threads, or backed by a thread pool, which is composed of OS threads anyways. An OS thread uses both user and kernel resources.

like image 194
Chris O Avatar answered Sep 25 '22 21:09

Chris O


In Linux, I understand that they are user space threads.

Linux kernel space threads are effectively part of the operating system, and typically run with high privilege so that they can access the address space of any process. Implementing Java or C# threads on Linux using kernel-space threads is unnecessary, and would be highly dangerous. (This assumes that it is technically possible ... which I don't think is the case.)

like image 23
Stephen C Avatar answered Sep 25 '22 21:09

Stephen C