On Thu, Jun 19, 2003, Kohn Emil Dan wrote about "Re: [Haifux] stack size": > In linux, the kernel stack size is 8K minus the size of the task_struct > struct.
Right, but as I said this 8k limit is for the Linux *kernel*, not for user-space programming. User space has a much larger stack which can be controlled with ulimit (on my system, the default is 8MB). Another note: When running a multi-threaded program, handling the stack (a seperate stack for each thread) is slightly different, and glibc (not the kernel) handles setting up these stacks. If I remember correctly this used to be stacks with a fixed size of 2MB per thread, but in later versions of glibc (since about 2 years ago) this changed to use the ulimit for stack-size. Since 8MB per thread is usually too much for multithreaded programs, it is typical for Linux multithreaded programs to lower this ulimit (see setrlimit(2)) before spaning the first thread. > Windows has a similar limitation on the stack size. By default each thread > has a maximum stack size of 1 Mbyte. Unlike Linux, the stack size limit is > fixed at compile time (actually at link time), because, if I remember > correctly, is written inside the executable. As I explained above, this was also true in multi-threaded Linux programs up to about two years ago (except the size was 2MB, not 1MB), but it changed later. -- Nadav Har'El | Thursday, Jun 19 2003, 19 Sivan 5763 [EMAIL PROTECTED] |----------------------------------------- Phone: +972-53-245868, ICQ 13349191 |Cats are smarter than dogs. You can't get http://nadav.harel.org.il |eight cats to pull a sled through snow. -------------------------------------------------------------------------- Haifa Linux Club Mailing List (http://www.haifux.org) To unsub send an empty message to [EMAIL PROTECTED]
