Re: max number of threads on a system

From: David Schwartz (davids@webmaster.com)
Date: Fri Mar 22 2002 - 00:49:15 EST


On Thu, 21 Mar 2002 20:05:39 -0500, joeja@mindspring.com wrote:
>What limits the number of threads one can have on a Linux system?

        Common sense, one would hope.

>I have a simple program that creates an array of threads and it locks up at
>the creation of somewhere between 250 and 275 threads.

        If it locks up, that's a bug. I remember older versions of glibc actually
had this bug. But it should simply fail to create them.

>The program just hangs indefinately unless a Control-C is hit.
>
>How can I increase this number or can I?

        Why increase the number of threads you can create before you trigger a bug?
Wouldn't it make more sense to *fix* the bug so that pthread_create returns
an error like it's supposed to?

        In any event, don't create so many threads. Create threads only to keep CPUs
busy or to pend I/Os that can't be done asynchronously.

        DS

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sat Mar 23 2002 - 22:00:26 EST