Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are user threads?

What are user threads? Below explanation says they are managed by userspace... Please explain how?

Threads are sometimes implemented in userspace libraries, thus called user threads. The kernel is not aware of them, so they are managed and scheduled in userspace.

like image 880
Raghu D P Avatar asked Jul 15 '26 08:07

Raghu D P


1 Answers

Every modern server or desktop OS, and all major mobile OSs, have a native thread library these days, so this question is not very relevant anymore. But basically, before this was the case, there were libraries -- most famously, the "Green threads library" -- which implemented cooperatively-multitasking threads as a user library. That "cooperatively multitasking" part is the important part: in general, such a library switches from one thread to another only when the thread calls some method that allows a switch to happen ("sleep", "yield", etc.) A user library generally can't do preemptive time-slicing; that's something that has to be done at the OS level.

like image 179
Ernest Friedman-Hill Avatar answered Jul 17 '26 18:07

Ernest Friedman-Hill



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!