stack limit

Francois Gouget fgouget at
Mon Jun 4 15:43:27 CDT 2001

On Mon, 4 Jun 2001, Stephen Crowley wrote:

> What is the correct way to increase the default stack size for winelib
> applications?

   Already answered, good :-)

> Also, are there any drawbacks to making the value fairly
> large?

   The only drawback I know of is that this limits the number of threads
your process can start. At least on Windows, I'm not entirely sure about
Linux but it should be the true too (Linux threads are kind of weird).
   What happens on Windows is that each thread gets its own stack so by
default 1MB of virtual memory is reserved for each thread. Since there's
a 2GB virtual memory space this means you can start a maximum of about
2000 threads. If you increase this to 10MB then you can only start 200
threads (per process).
   And that's why you have all the Java developpers complaining that
Java does not scale because it only support 2000 clients! Let me
explain. Until JDK1.4 is out Java does not have asynchronous I/O. So all
Java servers are of the 'one thread per client' type. So they all block
at about 2000 clients... except for the IBM JVM which uses a smaller
stack by default allowing it to support more than 2000 threads.
   So that's why one might want a small stack size. Of course I doubt
very much this affects your application (seems more scientific computing

   One more word on Java and threads :-) All (overgeneralization, I now)
Java developpers (and benchmarketers) say Linux is bad because it does
not scale well when you have thousands of runnable threads. And all
kernel developpers reply 'you have to be crazy to have thousands of
threads, your server performance will be bad anyway if you do that' (to
which I can only agree). Fortunately, as I said before, JDK 1.4 will
finally have asynchronous I/O, and even memory mapped files! So maybe
the Java guys will finally let the Linux scheduler off the hook.
   (Hmm, more than you wanted to know, sorry :-)

Francois Gouget         fgouget at
     We are Pentium of Borg. You will be approximated. Division is futile.

More information about the wine-devel mailing list