public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Michael Buesch <mb@bu3sch.de>
To: Robert Hancock <hancockr@shaw.ca>
Cc: linux-kernel@vger.kernel.org, Irfan Habib <irfan.habib@gmail.com>
Subject: Re: Maximum number of processes in Linux
Date: Wed, 16 Aug 2006 01:39:16 +0200	[thread overview]
Message-ID: <200608160139.17019.mb@bu3sch.de> (raw)
In-Reply-To: <44E254E4.6090508@shaw.ca>

On Wednesday 16 August 2006 01:12, Robert Hancock wrote:
> Irfan Habib wrote:
> > Hi,
> > 
> > What is the maximum number of process which can run simultaneously in
> > linux? I need to create an application which requires 40,000 threads.
> > I was testing with far fewer numbers than that, I was getting
> > exceptions in pthread_create
> 
> What architecture is this? On a 32-bit architecture with a 2MB stack 
> size (which I think is the default) you couldn't possibly create more 
> than 2048 threads just because of stack space requirements. Reducing the 
> stack size would get you more.

Hm, I'm on a 4way PPC64 machine with 2.5G RAM.
It can only create 509 pthreads and fails with ENOMEM
on the 510th.
That's not a really big machine, but I expected it to be able
to create somewhere around 8000 threads or so, at least. Especially
as it has a 64bit kernel and lots of memory.

Well...

That's my test app:

#include <stdio.h>
#include <pthread.h>
#include <string.h>
#include <errno.h>


static void * thread(void *arg)
{
        while (1)
                sleep(10);
}

int main(void)
{
        int err = 0;
        unsigned long i = 0;
        pthread_t t;

        while (!err) {
                err = pthread_create(&t, NULL, thread, NULL);
                i++;
                if (err) {
                        printf("Creating pthread %lu failed with \"%s\"\n",
                                i, strerror(errno));
                        break;
                }
                printf("%lu pthreads created\n", i);
        }

        return 0;
}

-- 
Greetings Michael.

  reply	other threads:[~2006-08-15 23:42 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <fa.evUDdOgjejpeNWKvgan3aKFF880@ifi.uio.no>
2006-08-15 23:12 ` Maximum number of processes in Linux Robert Hancock
2006-08-15 23:39   ` Michael Buesch [this message]
2006-08-16  0:04   ` Lee Revell
2006-08-15 17:59 Irfan Habib
2006-08-15 18:12 ` Stephen Hemminger
2006-08-15 18:22 ` linux-os (Dick Johnson)
2006-08-15 18:22   ` Willy Tarreau
2006-08-15 19:01     ` linux-os (Dick Johnson)
2006-08-15 19:13     ` linux-os (Dick Johnson)
2006-08-15 19:13       ` Willy Tarreau
2006-08-15 19:19       ` Arjan van de Ven
2006-08-15 19:26         ` Irfan Habib
2006-08-15 21:50           ` Avi Kivity
2006-08-16 10:01       ` Helge Hafting
2006-08-16 11:33         ` linux-os (Dick Johnson)
2006-08-17  8:00           ` Mike Galbraith
2006-08-16 11:58         ` Alistair John Strachan
2006-08-15 18:29   ` linux-os (Dick Johnson)
2006-08-15 18:37 ` Alan Cox
2006-08-15 21:00 ` Valdis.Kletnieks

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=200608160139.17019.mb@bu3sch.de \
    --to=mb@bu3sch.de \
    --cc=hancockr@shaw.ca \
    --cc=irfan.habib@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /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