From: Ritesh Kumar <digitalove@gmail.com>
To: Jakub Jelinek <jakub@redhat.com>
Cc: Linux Kernel Development <linux-kernel@vger.kernel.org>
Subject: Re: NPTL: stack limit limiting number of threads
Date: Fri, 13 May 2005 20:53:11 -0400 [thread overview]
Message-ID: <fc67f8b70505131753103d2dc7@mail.gmail.com> (raw)
In-Reply-To: <20050514000643.GI17420@devserv.devel.redhat.com>
On 5/13/05, Jakub Jelinek <jakub@redhat.com> wrote:
> 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
>
Oh great... I see your point now. I called the same recurse in an
alternative thread and found the limit to be 8M on Linux ( and Mac OS
X (Panther)) but around 1MB on FreeBSD. Thanks for the clarification!
Ritesh
--
http://www.cs.unc.edu/~ritesh/
prev parent reply other threads:[~2005-05-14 0:55 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
2005-05-14 0:53 ` Ritesh Kumar [this message]
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=fc67f8b70505131753103d2dc7@mail.gmail.com \
--to=digitalove@gmail.com \
--cc=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