Michael Sinz wrote:
>
> >Aren't we supposed to be able to overcome this limitation? It is really
> >sad to have this limitation hanging as a big dark cloud above us. ;-}
> >I believe that this limitation is not the case in some other "massively
> >inferior" OSes like NT. I would also like to augment that NT threads
> >appear to share the same address space, except for a private stack.
>
> Well, NT does have a thread limit. And it is system global. Depending
> on some registry things it could be a total of 512 threads or 128 threads
> or 1024 threads or... This limit is for all threads in all processes.
> So, if one processes uses 500 threads there are only 12 left for the whole
> rest of the system!
>
This is what I meant by "I am sure it is hidden somewhere, burried so deeply
that you'll probably get the blue screen of death when you reach it".
No OS is known to behave well in that limit, imagine moft's OSes....
>
> It is a shame that operating systems have such limits in the core rather
> than just limits based on available RAM/VM space or CPU power or...
>
> The problem is that things get tricky if you do that in threads and have
> shared memory (including access to autovariables, which means shared
> stack address space) and you have automatic stack address space extension
> since you need to partition out your virtual address space into the
> stack spaces... A generally ugly problem which gets even worse if you
> suddenly add twenty or two hundred threads to a process.
>
And since we (at least me) are not kernel programmers we should probably not
blame those people for not being able to handle this *bad* problem in a
perfect fashion.
>
> If stack space had to be defined by each thread, you can then be just
> limited by the total of 2gig or 3gig or 4gig of virtual address space
> for a process (which would mean that doing a large number of threads
> may end up with some problems with stack space for all of them, but
> the number would have to be rather large even if each thread needed
> 500K of stack!)
>
I believe that most systems have at least some 512M available for swaping,
not to mention a server that it is most likely to have a large number of
threads running in this ideal environment. (I should expect the virutal
addressing space used to the limit in such a case)
Dimitris