delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/08/19/10:37:49

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Date: Mon, 19 Aug 2002 10:37:39 -0400
From: Christopher Faylor <cgf AT redhat DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: Process exhaustion; please test
Message-ID: <20020819143738.GA18311@redhat.com>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <3D609310 DOT 1020700 AT gmx DOT net>
Mime-Version: 1.0
In-Reply-To: <3D609310.1020700@gmx.net>
User-Agent: Mutt/1.3.23.1i

On Mon, Aug 19, 2002 at 02:41:20PM +0800, Nils wrote:
>I've been having a problem running out of process IDs and wrote a small
>C program to test if it happens on other systems.  On my system I use
>up 2000 PIDs in ~500-550 forks.  This seems like a lot.  Could others
>run this and see if they see the same?  Please drop me or the list a
>line with how it runs on your machine.

I think you're working under the assumption that pids increase
monotically.  They don't.  The pid numbers are pretty much random.  The
first time I ran this program it terminated after one iteration since it
just happened to have created a new process with a pid more than 2000
greater than the initial pid.

Two problems with your test program: 1) it not passing an argument to
exit() and 2) it is not waiting for any of the process it creates.  That
means that it is leaking resources as all of the processes are becoming
zombies and staying around forever.  Unfortunately cygwin doesn't
currently show you all of the zombies in the ps output.

cgf

>  process=0;
>  initprocess=fork();
>
>  /* drop out of parent */
>  if (initprocess<=0) { exit(); }
>  endprocess=initprocess+2000;
>  printf("Starting process ID is %d; ending at %d.\n",initprocess, endprocess);
>
>  /* while to prevent exhausting processes completely */
>  while(process<endprocess)
>  {
>    process=fork();
>

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019