threads - thread_resource_error thrown by creating more than 256 threads
Hi, if I try to create more than 255 threads (256 for instance) I get the exception thread_resource_error thrown. How can I increase the amount of threads? My System: Linux 2.4.21, gcc 3.3.1 (posix thread model). cat /proc/sys/kernel/threads-max --> max 12152 threads per process currently allowed With best regards, Oliver
if I try to create more than 255 threads (256 for instance) I get the exception thread_resource_error thrown. How can I increase the amount of threads? My System: Linux 2.4.21, gcc 3.3.1 (posix thread model).
cat /proc/sys/kernel/threads-max --> max 12152 threads per process currently allowed
I don't believe this is an issue with Boost.Threads but with the underlying pthread system library it relies on. I could be wrong though.... anyone else? John.
Oliver.Kowalke@infineon.com wrote:
Hi, if I try to create more than 255 threads (256 for instance) I get the exception thread_resource_error thrown. How can I increase the amount of threads? My System: Linux 2.4.21, gcc 3.3.1 (posix thread model).
cat /proc/sys/kernel/threads-max --> max 12152 threads per process currently allowed
You're running into a different kernel limit. By default, Linux gives each process 2 GB of virtual address space (on 32-bit architectures) and allocates 8 MB of virtual address space for each thread's stack. This allows for 255 thread stacks, assuming that the executable and its heap are small. You can get more threads by changing their maximum stack size, but Boost.Threads doesn't provide a way to do this. In my opinion it is a mistake to create so many threads, though. Why do you think you need so many? Ben.
participants (3)
-
Ben Hutchings
-
John Maddock
-
Oliver.Kowalke@infineon.com