February 06, 2011
On Sunday 06 February 2011 05:05:24 d coder wrote:
> Greetings
> 
>   Is there a limit on the maximum number of threads that can be
> spawned? Or does it just depend on the value in
> /proc/sys/kernel/threads-max on a linux system?

Barring any bugs which manage to keep threads alive too long, it's going to be OS dependent. core.thread (which std.concurrency.spawn uses) uses pthreads on Linux. However, there _are_ currently some bugs with regards to spawned threads not terminating however, at least some of which have been fixed in the git repository (changes are in both druntime and phobos) but haven't been released yet. So, I don't know how successfully you can use spawn at the moment. Personally, I've had major problems with it due to bugs related to threads not terminating. Other people have used it successfully. Some of those bugs _are_ finally being fixed however, and hopefully spawn will work much better in the next release. Regardless, the max number of threads should be system dependent.

- Jonathan M Davis