Boost logo

Boost Users :

From: Ben Hutchings (ben.hutchings_at_[hidden])
Date: 2005-12-06 13:04:10


Oliver.Kowalke_at_[hidden] 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.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net