As I understand it, in many-to-one mapping, one kernel thread manages many user threads. This kernel thread helps the user threads make system calls etc. What I don’t understand is:
- Why do we have many-to-one mapping if a single blocking call would block all user threads managed by the kernel thread ?
- In many-to-one mapping of user threads to a kernel thread, do all the user threads have to be from the same process ?
- In many-to-one mapping, can all the user threads be run on different cores/CPUs at once or is only one of them run at a time ?
Advertisement
Answer
1) Why do we have many-to-one mapping if a single blocking call would block all user threads managed by the kernel thread?
The drawback of having one-to-one mapping is involvement of kernel when there is a context switch between the threads. Involvement of kernel results in several overheads.
2)In many-to-one mapping of user threads to a kernel thread, do all the user threads have to be from the same process?
Yes
3)In many-to-one mapping, can all the user threads be run on different cores/CPUs at once or is only one of them run at a time?
The pro feature of having a many-one mapping is that entire thread context-switching is maintained by the user-level thread library you use and as far as kernel is concerned it doesn’t know how many threads you have it gives the process a time slice to execute and it’s up to the thread library to give control to any of the threads. From this, you can easily see that in many-to-one mapping at any instant only one thread of the process can get the control.