This is the mail archive of the glibc-linux@ricardo.ecn.wfu.edu mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Slow pthread_create() under high load


<cut>

> 
> The LinuxThreads pthread_create works by passing a message through a pipe to a
> manager thread, and then blocking. The manager thread allocates the resources
> for the new thread and then creates it via clone(). It then unblocks the
> original thread which is suspended inside pthread_create().

At what point in this process will pthread_create() return? It actually returns
very fast - the slow part is getting to the first line of the function that is
being passed to pthread_create() in the newly created thread. 

My guess is that clone() should return very fast to the original thread, but
might take a while to return to the newly created thread, which is what is
causing the problem.

<cut>
-- 
Sasha Pachev

+------------------------------------------------------------------+
| TcX  ____  __     _____   _____  ___     ==  mysql@tcx.se        |
|     /*/\*\/\*\   /*/ \*\ /*/ \*\ |*|     Sasha Pachev            |
|    /*/ /*/ /*/   \*\_   |*|   |*||*|     mailto:sasha@mysql.com  |
|   /*/ /*/ /*/\*\/*/  \*\|*|   |*||*|     Provo, Utah, USA        |
|  /*/     /*/  /*/\*\_/*/ \*\_/*/ |*|____                         |
|  ^^^^^^^^^^^^/*/^^^^^^^^^^^\*\^^^^^^^^^^^                        |
|             /*/             \*\ Developers Team                  |
+------------------------------------------------------------------+

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]