This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Process exhaustion; please test


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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]