3
$\begingroup$

Is that a "thread" consists of both "user thread" and "kernel thread" as two parts?

And when I create a "thread", is that I create a "user thread" and another "kernel thread" is created "in the background" by OS also?

I'm confused because of the second picture.

The book I'm reading is "Operating System Concepts, 9th ed., SILBERSCHATZ", and it's at page 169. Thanks a lot

thread1

enter image description here

$\endgroup$
1
$\begingroup$

As the given text says, it is not necessary that for every new user thread a new kernel thread is also created. In fact different operating systems can implement this in a different way. Some OS will map every new user thread to a new kernel thread(one to one mapping), some can have a maximum limit on number of kernel threads beyond which a kernel thread will be mapped with more than one user thread(many to one). There can also be an OS which maps a single user thread to more than one kernel thread, and vice versa. This would be a many to many model.

All these models have their own pros and cons. Which model to choose would depend upon what functionality is required from OS, available hardware resources etc.

$\endgroup$
  • $\begingroup$ There can also be an OS which maps a single user thread to more than one kernel thread, so you meant one-to-many model? But it seems like there are only know 3 types: many-many, many-one, one-one in my book. $\endgroup$ – Ning Jul 27 '18 at 13:04
  • 1
    $\begingroup$ I also added "vice versa" at the end of my line. It makes it a many-to-many model. A one-to-many model could be any of the three models depending upon whether each user thread is mapped to a different set of kernel threads etc. $\endgroup$ – LoneCuriousWolf Jul 27 '18 at 13:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.