[lkml]   [2005]   [May]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: NPTL: stack limit limiting number of threads
On Fri, May 13, 2005 at 08:02:48PM -0400, Ritesh Kumar wrote:
> Thanks for your reply. I actually went ahead after getting your
> mail and coded up a small program to check the stack limit
> deliberately. The program is shown inline.
> #include <stdio.h>
> #define BUF_SIZE 1024000
> void recurse(int n){
> char ch[BUF_SIZE];
> if(n<=0)
> return;
> else
> recurse(n-1);
> }
> int main(argc, argv)
> int argc;
> char **argv;
> {
> if(argc!=2){
> printf("Usage: %s <n (megabytes)>\n", argv[0]);
> return 1;
> }
> printf("Checking for %dMB\n", atoi(argv[1]));
> recurse(atoi(argv[1]));
> }
> Its a fairly crude way to find out the actual stack limit. Basically,
> the resurse function recurses each time allocating ~1MB of space on
> the stack. The program segfaults exactly at the ulimit -s value of
> stack size on both linux and freebsd. So it does seem that the ulimit
> -s is the value of stack limit used on FreeBSD.

For the main stack sure. But now try to call that recurse in
some other thread.

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-05-14 02:12    [W:0.039 / U:7.980 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site