In a many-to-one threading model, when does the mapping actually start?

604 views Asked by At

From my understanding on the many-to-one model, all user threads are bound to a LWP which is then bound to a kernel thread. The threading library is responsible for scheduling the threads onto the LWP and the kernel only sees a single threaded application.

So, does the mapping happen the moment the program starts(main thread is executed) or it happens somewhere in between the program execution?

1

There are 1 answers

0
lsk On

To execute a user (multi or single threaded process), we need a kernel thread because the kernel thread is the minimum scheduling entity for the kernel scheduler. It is the job of the threads library to choose the right thread and schedule it on the LWP. Note that this includes the main thread as well. So, my guess would be that the binding happens at program exec time. Since I am guessing, I will wait for others to chime in as well.