<<链接,装载与库>>这本书上说,有3种windows用户线程/内核线程的关系。(1)一对一的,一共用户线程对应一个内核线程。但是内核线程不一定有对应的用户线程。
CreateThread()创建的就是这种类型的线程。(2)多对一的,多个用户线程公用一个内核线程。请问什么函数/api可以创建此类线程?
(3)多对多的。什么api可以做到呢?

解决方案 »

  1.   

    Kernel threads are used to provide privileged services to applications (such as system calls ). The are also used by the kernel to keep track of what all is running on the system, how much of which resources are allocated to what process, and to do scheduling.If your applications make a heavy use of system calls, the more user threads per kernel thread, the slower your applications will run, because the kernel thread will become a bottleneck, since all system calls will pass through it. On the flip side though, if you're programs rarely use system calls (or other kernel services), you can assign a large number of user threads to a kernel thread without much performance penalty, other than overhead.You can increase the number of kernel threads, but this adds overhead to the kernel in general, so while individual threads will be more responsive with respect to system calls, the system as a whole will become slower.That is why it is important to find a good balance between the number of kernel threads and the number of user threads per kernel thread.