Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S262636AbVENAGz (ORCPT ); Fri, 13 May 2005 20:06:55 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S262637AbVENAGz (ORCPT ); Fri, 13 May 2005 20:06:55 -0400 Received: from mx1.redhat.com ([66.187.233.31]:63205 "EHLO mx1.redhat.com") by vger.kernel.org with ESMTP id S262636AbVENAGp (ORCPT ); Fri, 13 May 2005 20:06:45 -0400 Date: Fri, 13 May 2005 20:06:43 -0400 From: Jakub Jelinek To: ritesh@cs.unc.edu Cc: Linux Kernel Development Subject: Re: NPTL: stack limit limiting number of threads Message-ID: <20050514000643.GI17420@devserv.devel.redhat.com> Reply-To: Jakub Jelinek References: <20050513202346.GG17420@devserv.devel.redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.1i Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1290 Lines: 44 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 > > #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", 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 - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/