more than 2k threads with -lpthread or -lthr

Julian Elischer julian at
Fri Jun 17 15:23:49 GMT 2005

Andriy Tkachuk wrote:
> On Friday 17 June 2005 00:50, David Xu wrote:
>>Here two sysctl also have to tuned to numbers larger than 2000 for
>>libthr and libpthread:
> Also i want to note, that i didn't change this sysctls.
> Theirs default values are:
> kern.threads.max_threads_per_proc: 1500
> kern.threads.max_groups_per_proc: 1500
> and i make 5000 threads with -lpthread.

in libpthread,
if threads are not in the kernel then they do not count towards these
they are only in the kernel if they are waiting on a kernel
resource (e.g. a file or socket etc.)
in libthread all threads will count owards this limit.

this is the difference between the two libraries.

One tries to be more careful with kernel resources and the other is a lot
simpler to get right :-)

> The only sysctls i change in order to work with such
> number of threads are kern.maxfiles and kern.ipc.maxsockets,
> but they are not about threads.
> Regards,
>   Andriy Tkachuk.
> _______________________________________________
> freebsd-threads at mailing list
> To unsubscribe, send any mail to "freebsd-threads-unsubscribe at"

More information about the freebsd-threads mailing list