Apache worker MPM and Linux threads
Apache's worker MPM creates multiple threads per process, where each thread handles a request. As of 2.6, the Linux kernel uses Native POSIX Threading Library, which has a 1:1 threading model. Given this, I would expect to see 100 apache processes if there are 100 simultaneous requests being serviced (one request -> one threa开发者_如何学Cd -> one process). However, after running some real world tests, I see this is not the case. What is going on here?
The 1-on-1 model of NPTL doesn't mean 1 thread per process. It rather means one user level thread to one kernel thread so that there is no need for two schedulers as in mxn model. This is explained in detail in the NPTL design here.
精彩评论