From: Jakub Jelinek <jakub@redhat.com>
To: ritesh@cs.unc.edu
Cc: Linux Kernel Development <linux-kernel@vger.kernel.org>
Subject: Re: NPTL: stack limit limiting number of threads
Date: Fri, 13 May 2005 20:06:43 -0400 [thread overview]
Message-ID: <20050514000643.GI17420@devserv.devel.redhat.com> (raw)
In-Reply-To: <fc67f8b705051317023859c443@mail.gmail.com>
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.
Jakub
next prev parent reply other threads:[~2005-05-14 0:06 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-05-13 19:49 NPTL: stack limit limiting number of threads Ritesh Kumar
2005-05-13 20:23 ` Jakub Jelinek
2005-05-14 0:02 ` Ritesh Kumar
2005-05-14 0:06 ` Jakub Jelinek [this message]
2005-05-14 0:53 ` Ritesh Kumar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20050514000643.GI17420@devserv.devel.redhat.com \
--to=jakub@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=ritesh@cs.unc.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox