Maximum number of threads

Alex via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Sep 24 01:55:22 PDT 2015


This should be a not so long question to answer, I hope.

I took an example from the "Programming in D" book, chapter 
"Message Passing Concurrency", around page 550. The question of 
interest was, how many threads I can have spawned at the same 
time.
So I made an array of robot objects from the example and found 
out: the maximum number is different on different PCs I have.
For example:
- on my mac I can have 2048 threads spawned at the same time
- on my linux machine the maximum number is 32192.
The numbers are quite fixed, however there were some small 
fluctuations on the linux machine.

The questions still remains: how do I know, what maximum number 
of threads I can have? Is it possible to calculate this value 
during runtime of my program? The two machines I have available 
for testing are very different, what is the main parameter which 
controls the number of possible threads? (CPU maybe? Number of 
cores? RAM is not I think at the moment...)

Thanks in advance
Alex


More information about the Digitalmars-d-learn mailing list