简体   繁体   English

在多对一线程模型中,映射实际上何时开始?

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

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. 根据我对多对一模型的理解,所有用户线程都绑定到LWP,然后LWP绑定到内核线程。 The threading library is responsible for scheduling the threads onto the LWP and the kernel only sees a single threaded application. 线程库负责将线程调度到LWP上,内核仅看到一个线程应用程序。

So, does the mapping happen the moment the program starts(main thread is executed) or it happens somewhere in between the program execution? 那么,映射是在程序启动(执行主线程)时发生还是在程序执行之间的某个时刻发生?

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. 线程库的工作是选择合适的线程并在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. 由于我在猜,所以我也会等待其他人的注意。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM