Thin Lock Implementation

Steven Schveighoffer schveiguy at yahoo.com
Tue Aug 19 07:56:51 PDT 2008


"Sascha Katzner" wrote
> Steven Schveighoffer wrote:
>> On a 32-bit system, the amount of addressable memory space and the
>> stack size are the factors that limit the number of threads.  For
>> example, if addressable space is 2GB, and each thread has a 1MB
>> stack, that's 2000 threads max (this is the typical situation for
>> Windows).
>
> Not exactly right, since the stack is organized in 4kb pages and these
> pages are not initialized until they are first used they usually require
> a lot less than 1mb.

Hm... I read the limit above online 
(http://blogs.msdn.com/oldnewthing/archive/2005/07/29/444912.aspx).  I think 
maybe the pages aren't initialized, but doesn't the system have to reserve 
them because it has to guarantee a 1MB stack for each?  Or maybe that guy is 
completely wrong, or the concept has been fixed :)

-Steve 





More information about the Digitalmars-d mailing list