more than 2k threads with -lpthread or -lthr

David Xu davidxu at freebsd.org
Thu Jun 16 21:50:24 GMT 2005


Marc Olzheim wrote:

>On Thu, Jun 16, 2005 at 06:52:20PM +0800, David Xu wrote:
>  
>
>>Both libpthread and libthr use 1M bytes stack on 32bits platform
>>and 2M bytes stack on 64bits platform. I think 2k threads needs
>>2G stack on i386, this is too large.
>>    
>>
>
>In which case pthread_attr_setstacksize() might help ?
>
>Marc
>  
>
pthread_attr_setstacksize definitively helps, libc_r default uses 64k
stack for thread, this is very small stack.

Here two sysctl also have to tuned to numbers larger than 2000 for
libthr and libpthread:
kern.threads.max_groups_per_proc
kern.threads.max_threads_per_proc

David Xu



More information about the freebsd-threads mailing list